:root {
    --bg: #f4f6f9;
    --bg-subtle: #eef1f6;
    --surface: #ffffff;
    --surface-hover: #fafbfc;
    --sidebar: #111827;
    --sidebar-hover: #1f2937;
    --sidebar-active: #1e3a5f;
    --sidebar-text: #9ca3af;
    --sidebar-text-active: #f9fafb;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --primary: #0f766e;
    --primary-light: #14b8a6;
    --primary-bg: #ecfdf5;
    --primary-hover: #0d9488;
    --accent: #c2410c;
    --success: #059669;
    --success-bg: #ecfdf5;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --info: #0284c7;
    --info-bg: #f0f9ff;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow: 0 4px 16px rgba(17, 24, 39, 0.08);
    --shadow-lg: 0 12px 40px rgba(17, 24, 39, 0.12);
    --transition: 0.18s ease;
    --bottom-nav-h: 4.25rem;
    --mobile-header-h: 3.5rem;
    --touch-min: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

.icon { flex-shrink: 0; display: block; }

/* ── Layout ── */
.app {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.mobile-header,
.mobile-bottom-nav {
    display: none;
}

.sidebar {
    width: 260px;
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.35);
}

.brand-text { display: flex; flex-direction: column; }
.brand-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #f9fafb;
    line-height: 1.2;
}
.brand-sub {
    font-size: 0.7rem;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-section {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    padding: 0.5rem 0.75rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary-light);
}

.nav-link.active .icon { color: var(--primary-light); }

.sidebar-footer {
    padding: 1rem 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
}

.user-name {
    font-size: 0.8rem;
    color: #e5e7eb;
    font-weight: 500;
}

.main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem 2.5rem 3rem;
    max-width: 1280px;
    width: 100%;
}

/* Touch-friendly primary actions */
.btn-touch,
.btn-done-now {
    min-height: var(--touch-min);
}

.btn-touch {
    width: 100%;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
}

/* ── Login / Setup ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--sidebar);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(15, 118, 110, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(20, 184, 166, 0.1) 0%, transparent 40%);
    padding: 1.5rem;
}

.login-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.login-brand .brand-mark { width: 48px; height: 48px; border-radius: 12px; }

.login-card h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.login-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    font-size: 0.9rem;
}

/* ── Page header ── */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.925rem;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-print-status {
    flex-shrink: 0;
    white-space: nowrap;
}

.page-toolbar {
    margin-bottom: 1.25rem;
}

.mobile-only {
    display: none;
}

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-danger .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card:not(.stat-danger):not(.stat-warning):not(.stat-success) .stat-icon {
    background: var(--bg-subtle);
    color: var(--text-secondary);
}

.stat-body { flex: 1; min-width: 0; }
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.2rem;
}

.stat-danger .stat-value { color: var(--danger); }
.stat-warning .stat-value { color: var(--warning); }
.stat-success .stat-value { color: var(--success); }

/* ── Cards & sections ── */
.card, .section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-xs);
}

.card h2, .section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-danger .section-title-icon { background: var(--danger-bg); color: var(--danger); }
.section-warning .section-title-icon { background: var(--warning-bg); color: var(--warning); }

.section-danger {
    border-color: #fecaca;
    border-left: 4px solid var(--danger);
}

.section-warning {
    border-color: #fde68a;
    border-left: 4px solid var(--warning);
}

.card h3 {
    font-size: 0.875rem;
    margin: 1.25rem 0 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group small, .hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.45;
}

.hint code {
    background: var(--bg-subtle);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--primary);
    border: 1px solid var(--border);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:hover, select:hover, textarea:hover {
    border-color: #9ca3af;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.form-row { display: flex; gap: 0.85rem; }
.form-row .form-group { flex: 1; }

.form-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.55rem;
    color: var(--text);
    cursor: pointer;
    font-size: 0.875rem;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(15, 118, 110, 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.25);
}
.btn-success:hover { background: #047857; color: #fff; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-outline {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-subtle);
    border-color: #9ca3af;
    color: var(--text);
}

.btn-ghost {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #d1d5db;
    width: 100%;
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; }
.btn-block { width: 100%; }
.input-sm { max-width: 72px; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid #bae6fd; }
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.badge-muted { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Table ── */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th, .table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: none; }

.table td strong { font-weight: 600; color: var(--text); }

/* ── Item cards ── */
.item-list { display: flex; flex-direction: column; gap: 0.85rem; }

.item-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.item-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}

.item-card.compact { padding: 1rem; }

.item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.item-category {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--primary-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.item-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.item-notes {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0 0 0.65rem;
    font-weight: 400;
}

.schedule-name-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.item-card h3 .schedule-name-tag {
    display: block;
    margin: 0.35rem 0 0;
    width: fit-content;
}

.schedules-heading {
    font-size: 0.95rem;
    margin: 1.25rem 0 0.75rem;
    color: var(--text-secondary);
}

.schedule-form-row {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.85rem;
}

.schedule-form-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.item-group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.85rem;
}

.item-group-card[hidden] {
    display: none !important;
}

.item-group-header {
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
}

.item-group-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0.35rem 0 0.35rem;
    color: var(--text);
}

.item-group-header .item-category {
    font-size: 0.72rem;
}

.item-group-schedules {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-top: 0.55rem;
}

.item-group-empty {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
}

.dashboard-item-list .item-group-card {
    margin-bottom: 1rem;
}

.schedule-line {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
}

.schedule-line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.schedule-check-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.item-group-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.mt-2 { margin-top: 1.5rem; }

.item-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
}

.item-card-dates {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.item-card-dates strong { color: var(--text-secondary); font-weight: 600; }

/* ── Categories ── */
.category-list { display: flex; flex-direction: column; gap: 0.85rem; }

.category-item {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.category-item form.inline-form { flex: 1; }
.category-item .inline-form textarea { margin-top: 0.5rem; }

.filter-bar {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    align-items: center;
}

.filter-bar .btn-filter-category,
.filter-bar .btn {
    flex-shrink: 0;
    min-height: var(--touch-min);
    padding-left: 1rem;
    padding-right: 1rem;
}

.filter-bar .btn { border-radius: var(--radius-sm); }
.filter-bar .btn-primary { box-shadow: none; }

.btn-clear-filters {
    margin-left: auto;
    color: var(--text-muted);
    border-style: dashed;
}

.btn-clear-filters:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-bg);
}

.filter-bar .btn-clear-filters:not([hidden]) {
    display: inline-flex;
}

/* ── Alerts ── */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid #a7f3d0;
    color: #047857;
}

.alert-danger {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-warning {
    background: var(--warning-bg);
    border: 1px solid #fde68a;
    color: #b45309;
}

.alert-info {
    background: var(--info-bg);
    border: 1px solid #bae6fd;
    color: #0369a1;
}

.empty-state {
    color: var(--text-muted);
    padding: 2.5rem 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.code-block {
    background: var(--sidebar);
    color: #e5e7eb;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    overflow-x: auto;
    border: none;
    margin: 0.5rem 0;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.hint-list {
    padding-left: 1.25rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

.hint-list li { margin-bottom: 0.4rem; }

.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: 1.5rem; }
.inline { display: inline; }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast.success {
    border-left: 4px solid var(--success);
    color: var(--success);
}

.toast.danger {
    border-left: 4px solid var(--danger);
    color: var(--danger);
}

@keyframes slideIn {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── Responsive: Mobile-first (primary experience) ── */
@media (max-width: 768px) {
    .sidebar-desktop { display: none; }

    .mobile-header {
        display: block;
        position: sticky;
        top: 0;
        z-index: 90;
        background: var(--sidebar);
        padding-top: env(safe-area-inset-top, 0px);
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .mobile-header-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.65rem 1rem;
        min-height: var(--mobile-header-h);
    }

    .mobile-header-brand {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        min-width: 0;
    }

    .mobile-header-brand .brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 9px;
        flex-shrink: 0;
    }

    .mobile-header-title {
        font-size: 0.95rem;
        font-weight: 700;
        color: #f9fafb;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-header-user {
        font-size: 0.72rem;
        color: #9ca3af;
    }

    .mobile-logout {
        flex-shrink: 0;
        min-width: var(--touch-min);
        min-height: var(--touch-min);
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.06);
        border-color: rgba(255,255,255,0.12);
        color: #d1d5db;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -4px 20px rgba(17, 24, 39, 0.08);
    }

    .bottom-nav-link {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0.5rem 0.25rem;
        min-height: var(--bottom-nav-h);
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.65rem;
        font-weight: 600;
        transition: color var(--transition);
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-link span {
        line-height: 1.1;
        text-align: center;
    }

    .bottom-nav-link.active {
        color: var(--primary);
    }

    .bottom-nav-link.active .icon {
        color: var(--primary);
    }

    .app { flex-direction: column; }

    .app-body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    .main {
        margin-left: 0;
        padding: 1rem;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }

    .page-header { display: none; }

    .mobile-only {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: column;
        gap: 0.65rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
    }

    .stat-value { font-size: 1.5rem; }

    .grid-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
        align-items: stretch;
        width: 100%;
    }

    .grid-2 > .card,
    .grid-2 > .section {
        width: 100%;
        min-width: 0;
    }

    .page-grid-mobile-list-first {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .page-grid-mobile-list-first > .card,
    .page-grid-mobile-list-first > .section {
        width: 100%;
        min-width: 0;
    }

    .page-grid-mobile-list-first .page-section-list { order: -1; }
    .page-grid-mobile-list-first .page-section-form { order: 1; }

    .item-list,
    .item-card {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .item-card h3 {
        word-break: break-word;
    }

    .item-card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .form.inline {
        display: block;
        width: 100%;
    }

    .card, .section {
        padding: 1.15rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-sm);
    }

    .form-row { flex-direction: column; gap: 0; }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .btn,
    .form-actions form {
        width: 100%;
    }

    .form-actions form .btn { width: 100%; }

    .btn {
        min-height: var(--touch-min);
    }

    .btn-sm {
        min-height: var(--touch-min);
        padding: 0.55rem 0.85rem;
        font-size: 0.85rem;
    }

    input[type="text"], input[type="email"], input[type="password"],
    input[type="number"], input[type="date"], select, textarea {
        font-size: 16px;
        padding: 0.75rem 0.85rem;
        min-height: var(--touch-min);
    }

    select { min-height: var(--touch-min); }

    .filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
        max-width: 100%;
        border-radius: var(--radius-sm);
    }

    .filter-bar::-webkit-scrollbar { display: none; }

    .btn-clear-filters {
        margin-left: 0;
    }

    .category-item {
        flex-direction: column;
    }

    .category-item > form:last-child {
        width: 100%;
    }

    .category-item > form:last-child .btn {
        width: 100%;
    }

    .item-card-dates {
        flex-direction: column;
        gap: 0.35rem;
    }

    .item-card .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .item-card .form-actions .btn,
    .item-card .form-actions form {
        width: 100%;
    }

    .table-responsive-cards td[data-label="Στοιχείο"] {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .table-responsive-cards td[data-label="Στοιχείο"]::before {
        margin-bottom: 0.15rem;
    }

    .table-responsive-cards td[data-label="Στοιχείο"] .item-notes {
        width: 100%;
        margin-top: 0.25rem;
    }

    /* Table → cards on mobile */
    .table-responsive-cards .table-wrap {
        border: none;
        overflow: visible;
    }

    .table-responsive-cards thead { display: none; }

    .table-responsive-cards tbody tr {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 0.85rem;
        padding: 0.35rem 0;
        box-shadow: var(--shadow-xs);
    }

    .table-responsive-cards tbody tr[hidden] { display: none !important; }

    .table-responsive-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: 0.6rem 1rem;
        border-bottom: none;
        text-align: right;
    }

    .table-responsive-cards td::before {
        content: attr(data-label);
        font-size: 0.68rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        flex-shrink: 0;
    }

    .table-responsive-cards td.td-actions {
        display: block;
        padding: 0.75rem 1rem 1rem;
        border-top: 1px solid var(--border);
        margin-top: 0.25rem;
    }

    .table-responsive-cards td.td-actions::before { display: none; }

    .table-responsive-cards td.td-actions .btn {
        width: 100%;
        min-height: 48px;
        font-size: 0.95rem;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 0.75rem);
        max-width: none;
    }

    .login-page { padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }

    .login-card {
        padding: 1.75rem 1.25rem;
        border-radius: var(--radius);
    }

    .code-block {
        font-size: 0.72rem;
        word-break: break-all;
    }
}

@media (max-width: 380px) {
    .bottom-nav-link span { font-size: 0.6rem; }
    .stats-grid { gap: 0.5rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .main { padding: 1.5rem; }
    .grid-2 { grid-template-columns: 1fr; }
}
