:root {
    --zm-primary: #1f4d3a;
    --zm-primary-dark: #163628;
    --zm-primary-light: #2f6b4f;
    --zm-bg: #f4f7f5;
    --zm-card-border: #dfe8e2;
    --zm-bottom-nav-h: 4.25rem;
    --zm-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--zm-bg);
    font-size: 16px;
}

.zm-app-body {
    padding-bottom: calc(var(--zm-bottom-nav-h) + var(--zm-safe-bottom));
}

.zm-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--zm-primary);
    color: #fff;
    padding-top: env(safe-area-inset-top, 0px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.zm-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    min-height: 3.25rem;
}

.zm-topbar-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
}

.zm-user-name {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.875rem;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zm-pwa-banner {
    background: linear-gradient(90deg, #163628, #2f6b4f);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.zm-desktop-nav {
    background: #fff;
    border-bottom: 1px solid var(--zm-card-border);
}

.zm-desktop-nav .nav-link {
    color: var(--zm-primary);
    font-weight: 500;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.zm-main-app {
    min-height: calc(100vh - 3.25rem);
}

.zm-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fff;
    border-top: 1px solid var(--zm-card-border);
    padding: 0.35rem 0 calc(0.35rem + var(--zm-safe-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.zm-bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.25rem;
    color: #66756d;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    min-height: 3.5rem;
}

.zm-bottom-link i {
    font-size: 1.25rem;
}

.zm-bottom-icon-wrap {
    position: relative;
    display: inline-flex;
}

.zm-task-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}

.zm-task-badge-btn {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
}

.zm-task-badge-tile {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
}

.zm-bottom-icon-wrap .zm-task-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.55rem;
}

.zm-bottom-link.active,
.zm-bottom-link:hover {
    color: var(--zm-primary);
}

.hero-panel,
.zm-card,
.zm-result-card,
.zm-detail-card {
    background: #fff;
    border: 1px solid var(--zm-card-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.hero-panel {
    padding: 1.25rem;
}

.zm-card .card-header {
    background: #eef5f0;
    font-weight: 600;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
}

.zm-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.zm-quick-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem;
    min-height: 7.5rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.zm-quick-tile:hover,
.zm-quick-tile:focus {
    color: inherit;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(31, 77, 58, 0.12);
}

.zm-quick-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef5f0;
    color: var(--zm-primary);
    font-size: 1.2rem;
}

.zm-search-bar {
    display: grid;
    gap: 0.75rem;
}

.zm-search-bar .form-control,
.zm-search-bar .btn {
    min-height: 3rem;
    border-radius: 12px;
}

.zm-result-card {
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.zm-result-card:last-child {
    margin-bottom: 0;
}

.zm-result-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.zm-result-meta {
    color: #66756d;
    font-size: 0.875rem;
}

.zm-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.zm-result-actions .btn {
    flex: 1 1 auto;
    min-height: 2.75rem;
}

.zm-detail-card {
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.zm-detail-card dt {
    color: #66756d;
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
}

.zm-detail-card dd {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.zm-detail-card dd:last-child {
    margin-bottom: 0;
}

.zm-alert {
    border-radius: 12px;
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(135deg, #1f4d3a, #2f6b4f);
}

.auth-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.auth-logo {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 1rem;
}

.btn-primary {
    background-color: var(--zm-primary);
    border-color: var(--zm-primary);
    min-height: 2.75rem;
    border-radius: 12px;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--zm-primary-dark);
    border-color: var(--zm-primary-dark);
}

.btn-outline-primary {
    color: var(--zm-primary);
    border-color: var(--zm-primary);
    border-radius: 12px;
}

.btn-outline-primary:hover {
    background: var(--zm-primary);
    border-color: var(--zm-primary);
}

.btn-success,
.btn-outline-secondary {
    border-radius: 12px;
    min-height: 2.75rem;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: 12px;
    min-height: 2.75rem;
}

textarea.form-control {
    min-height: auto;
}

.table thead th {
    background: #eef5f0;
}

.zm-page-title {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-weight: 700;
}

@media (min-width: 768px) {
    .zm-app-body {
        padding-bottom: 0;
    }

    .zm-search-bar {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .zm-search-bar.zm-search-bar-4 {
        grid-template-columns: 1.4fr 0.8fr 0.8fr auto;
    }
}

@media (min-width: 992px) {
    .zm-quick-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (display-mode: standalone) {
    .zm-pwa-banner {
        display: none !important;
    }
}
