:root {
    --bg: #f4eee6;
    --bg-accent: linear-gradient(135deg, #f3e4d2 0%, #f7f1ea 48%, #eadcc8 100%);
    --surface: #ffffff;
    --text: #1c1917;
    --muted: #78716c;
    --primary: #c2410c;
    --primary-light: #ffedd5;
    --primary-hover: #9a3412;
    --border: #e7e0d6;
    --border-focus: #fdba74;
    --danger: #dc2626;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.06);
    --shadow: 0 4px 24px rgba(28, 25, 23, 0.08);
    --shadow-lg: 0 12px 40px rgba(28, 25, 23, 0.12);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    background-image: var(--bg-accent);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--primary-hover); }

.container {
    width: min(960px, 92vw);
    margin: 0 auto;
    padding: 32px 0 56px;
}

/* ── Header ── */
.site-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand:hover { text-decoration: none; color: var(--primary); }

.brand-logo {
    width: 40px;
    height: auto;
    display: block;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-links > a:not(.btn) {
    color: var(--muted);
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
}

.nav-links > a:not(.btn):hover {
    color: var(--text);
    background: #f1f5f9;
    text-decoration: none;
}

.user-info {
    color: var(--muted);
    font-size: 13px;
    padding: 4px 10px;
    background: #f8fafc;
    border-radius: 999px;
    border: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(194, 65, 12, 0.32);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgba(194, 65, 12, 0.4);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text);
    border-color: var(--border);
}

.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; min-width: 120px; }

/* ── Page head ── */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-head h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Form page (centered card) ── */
.form-page {
    display: flex;
    justify-content: center;
    padding: 16px 0 32px;
}

.form-card {
    width: min(440px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.form-card-header {
    text-align: center;
    padding: 32px 28px 8px;
}

.form-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--primary-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.form-card-header h1 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.form-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.form-card-header-wide {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    padding: 28px 32px 4px;
}

.form-card-header-wide .form-icon {
    margin: 0;
    flex-shrink: 0;
}

.form-card-header-wide h1 {
    margin: 0 0 4px;
}

.form-section {
    margin: 0 0 8px;
    padding: 20px 0 8px;
    border-top: 1px solid var(--border);
}

.form-section:first-of-type {
    border-top: 0;
    padding-top: 8px;
}

.form-section-title {
    margin: 0 0 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.08em;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.case-form {
    padding: 24px 28px 32px;
}

.field {
    margin-bottom: 20px;
}

.field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.field-head label {
    margin-bottom: 0;
}

.field-hint.is-error {
    color: var(--error-text);
}

.field-hint.is-success {
    color: var(--success-text);
}

.field label:not(.time-range-item) {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="time"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="search"],
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
    color: var(--text);
    background: #fafbfc;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field textarea {
    min-height: 132px;
    line-height: 1.6;
    resize: vertical;
}

.field select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field input[type="date"]:focus,
.field input[type="time"]:focus,
.field input[type="email"]:focus,
.field input[type="tel"]:focus,
.field input[type="search"]:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.15);
}

.field input::placeholder { color: #94a3b8; }

.field input[type="datetime-local"] {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
    background: #fafbfc;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field input.field-readonly {
    background: #f1f5f9;
    color: #475569;
    cursor: default;
    border-style: dashed;
}

/* ── Upload zone ── */
.upload-zone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.is-dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.upload-zone.has-file {
    border-color: #86efac;
    background: #f0fdf4;
    border-style: solid;
}

.upload-zone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-zone-body {
    padding: 28px 20px;
    text-align: center;
    pointer-events: none;
}

.upload-zone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    background: #fff;
    border-radius: 12px;
    font-size: 20px;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.upload-zone-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.upload-zone-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.upload-zone-file {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    color: #059669;
    font-weight: 500;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 28px;
    padding-top: 8px;
}

.form-actions .btn-primary { flex: 1; }

/* ── Alerts ── */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error { background: var(--error-bg); color: var(--error-text); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }

.muted { color: var(--muted); font-size: 14px; }

/* ── List page ── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
    background: var(--surface);
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.assignee-multi {
    flex: 1 1 100%;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #faf8f5;
    padding: 10px 12px;
}
.assignee-multi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.assignee-multi-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 180px;
    overflow: auto;
}
.assignee-multi-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.assignee-multi-item:has(input:checked) {
    border-color: #fdba74;
    background: #fff7ed;
    color: #c2410c;
}
.assignee-multi-item input {
    width: auto;
    margin: 0;
    flex: none;
}


.filter-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fafbfc;
}

.filter-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.filter-status {
    min-width: 130px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fafbfc;
}

.filter-status:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.batch-export-form {
    display: block;
}

.batch-export-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-lg);
}

.batch-select-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.batch-select-all input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.batch-export-hint {
    font-size: 13px;
}

.batch-selected-count {
    font-size: 14px;
}

.batch-selected-total {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.case-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    position: relative;
}

.case-card-selectable:has(.case-select-input:checked) {
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.case-select {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1;
    display: inline-flex;
    cursor: pointer;
}

.case-select input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.case-card-selectable {
    padding-left: 44px;
}

.case-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.case-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.case-card-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.case-card-head h2 a {
    color: var(--text);
    text-decoration: none;
}

.case-card-head h2 a:hover { color: var(--primary); }

.case-meta {
    display: grid;
    gap: 10px;
    margin: 16px 0;
    padding: 12px 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.case-meta div {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.case-meta dt { color: var(--muted); margin: 0; }
.case-meta dd {
    margin: 0;
    font-weight: 500;
    max-width: 65%;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-actions { margin-top: 4px; }

.empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px dashed #cbd5e1;
}

.empty-state p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 15px;
}

/* ── Detail page ── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 20px;
}

.detail-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.detail-panel h2 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 12px;
}

.info-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 15px;
}

.info-list div:last-child { border-bottom: none; }
.info-list dt { color: var(--muted); margin: 0; }
.info-list dd { margin: 0; font-weight: 600; text-align: right; }

.file-list { list-style: none; padding: 0; margin: 0; }

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-bottom: 8px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.file-item strong { display: block; font-size: 14px; margin-bottom: 2px; }

.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

.upload-form {
    display: grid;
    gap: 12px;
    padding: 16px;
    margin-bottom: 16px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px dashed var(--border);
}

.upload-form label { font-size: 14px; font-weight: 500; }

.upload-form input[type="file"] {
    font-size: 13px;
}

/* ── Auth pages ── */
.auth-card {
    max-width: 400px;
    margin: 48px auto;
    background: var(--surface);
    padding: 36px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin: 0 0 16px;
}

.auth-logo img {
    display: block;
    width: min(220px, 70%);
    height: auto;
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 1.5rem;
    text-align: center;
}

.auth-card .muted { text-align: center; margin-bottom: 24px; }

.auth-card-login {
    max-width: 460px;
}

.disclaimer-box {
    margin: 4px 0 16px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
}

.disclaimer-box-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.disclaimer-box-summary {
    margin: 0 0 8px;
    color: var(--muted);
}

.disclaimer-link {
    font-size: 13px;
    font-weight: 500;
}

.disclaimer-check {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px !important;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    cursor: pointer;
}

.disclaimer-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.disclaimer-check a {
    font-weight: 500;
}

.container-narrow {
    width: min(760px, 94vw);
}

.page-head-simple {
    margin-bottom: 16px;
}

.disclaimer-page-panel {
    padding: 24px 28px;
}

.disclaimer-document {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
}

.disclaimer-lead {
    margin: 0 0 24px;
    padding: 14px 16px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    font-weight: 500;
    color: #92400e;
}

.disclaimer-section {
    margin-bottom: 24px;
}

.disclaimer-section:last-child {
    margin-bottom: 0;
}

.disclaimer-section h2 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.disclaimer-section ul {
    margin: 0;
    padding-left: 1.25em;
}

.disclaimer-section li {
    margin-bottom: 8px;
}

.disclaimer-section li:last-child {
    margin-bottom: 0;
}

.disclaimer-page-foot {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
}

.form-stack label {
    display: block;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

.form-stack input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fafbfc;
}

.form-stack input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-block { width: 100%; margin-top: 8px; }

/* ── First login setup ── */
.setup-main {
    width: min(800px, 94vw);
    padding: 24px 0 48px;
}

.setup-shell {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 80px);
    padding: 8px 0 32px;
}

.setup-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.setup-header {
    padding: 32px 36px 24px;
    text-align: center;
    background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
    border-bottom: 1px solid #e8eef5;
}

.setup-logo {
    display: block;
    width: min(200px, 64%);
    height: auto;
    margin: 0 auto 16px;
}

.setup-badge {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

.setup-header h1 {
    margin: 0 0 8px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.setup-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.setup-form {
    padding: 28px 36px 36px;
}

.setup-form .alert {
    margin-bottom: 20px;
}

.setup-section + .setup-section {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid #f1f5f9;
}

.setup-section-title {
    margin: 0 0 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.setup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
    align-items: start;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.setup-field-full {
    grid-column: 1 / -1;
}

.setup-field label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    min-height: 1.4em;
}

.setup-field input,
.setup-field select {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 15px;
    line-height: 1.4;
    color: var(--text);
    background: #fafbfc;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.setup-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.setup-field input:focus,
.setup-field select:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.15);
}

.setup-field input.setup-readonly {
    background: #f1f5f9;
    color: #475569;
    cursor: default;
    border-style: dashed;
}

.setup-field input::placeholder {
    color: #94a3b8;
}

.setup-hint {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.setup-submit {
    width: 100%;
    margin-top: 32px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
}

.farewell-header {
    background: linear-gradient(180deg, #ffedd5 0%, #fff 100%);
    border-bottom-color: #f3e4d2;
}

.farewell-badge {
    background: #ffedd5;
    color: #9a3412;
}

.farewell-body {
    padding: 32px 36px 40px;
    text-align: center;
}

.farewell-quote {
    margin: 0 0 12px;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text);
}

.farewell-note {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
}

.farewell-body .setup-submit {
    display: inline-flex;
    width: auto;
    min-width: 180px;
    margin-top: 0;
    justify-content: center;
}

@media (max-width: 640px) {
    .setup-header,
    .setup-form,
    .farewell-body {
        padding-left: 22px;
        padding-right: 22px;
    }

    .setup-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Detail: required documents ── */
/* ── Detail split: preview left + docs right ── */
.detail-split {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

.preview-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
    height: calc(100vh - 96px);
    max-height: calc(100vh - 96px);
    min-height: 480px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-panel-head {
    padding: 16px 18px 0;
    border-bottom: 1px solid var(--border);
}

.preview-panel-head h2 {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
}

.preview-tabs {
    display: flex;
    gap: 4px;
    padding-bottom: 0;
}

.preview-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}

.preview-tab:hover { color: var(--text); }

.preview-tab.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.preview-tab[data-has-file="0"] { opacity: 0.55; }

.preview-area {
    flex: 1 1 0;
    min-height: calc(100vh - 220px);
    overflow: auto;
    background: #f1f5f9;
    margin: 0;
}

.preview-frame {
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 220px);
    border: none;
    background: #525659;
    display: block;
}

.preview-fallback {
    text-align: center;
    padding: 8px;
    margin: 0;
    font-size: 13px;
    background: #fff;
    border-top: 1px solid var(--border);
}

.preview-fallback a { text-decoration: none; }

.preview-image {
    display: block;
    max-width: 100%;
    margin: 0 auto;
    padding: 16px;
}

.preview-docx {
    padding: 24px 28px;
    background: #fff;
    min-height: 280px;
    font-size: 14px;
    line-height: 1.7;
}

.preview-docx table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.preview-docx td,
.preview-docx th {
    border: 1px solid #cbd5e1;
    padding: 6px 10px;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    height: 100%;
    padding: 32px;
    text-align: center;
    color: var(--muted);
}

.preview-placeholder-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.preview-placeholder p { margin: 4px 0; }

.preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    height: 100%;
    color: var(--muted);
    font-size: 14px;
}

.preview-filename {
    padding: 10px 18px;
    margin: 0;
    font-size: 12px;
    border-top: 1px solid var(--border);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.required-docs-side .doc-list {
    max-width: none;
}

@media (min-width: 961px) {
    .required-docs-side {
        position: sticky;
        top: 88px;
        align-self: start;
        max-height: calc(100vh - 96px);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 2px;
        padding-bottom: 12px;
        scroll-padding-bottom: 12px;
    }

    .required-docs-side::-webkit-scrollbar {
        width: 6px;
    }

    .required-docs-side::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 999px;
    }
}

.doc-file-item.preview-trigger {
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.doc-file-item.preview-trigger:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.doc-file-item.is-previewing {
    background: #dbeafe !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

@media (max-width: 960px) {
    .detail-split {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .required-docs-side {
        order: 1;
    }

    .preview-panel {
        order: 2;
        position: static;
        height: auto;
        max-height: none;
        min-height: 360px;
    }

    .preview-area {
        min-height: 360px;
        max-height: 70vh;
    }

    .preview-frame,
    .preview-placeholder,
    .preview-loading {
        min-height: 360px;
        max-height: 70vh;
    }

    .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 20px;
    }

    .doc-list {
        max-width: none;
    }
}


.detail-panel-info {
    margin-bottom: 24px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px 32px;
}

.info-grid-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.info-grid-item dt {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

.info-grid-item dd {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    word-break: break-word;
}

.info-grid-status {
    grid-column: 1 / -1;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.info-list-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 24px;
}

.info-list-inline div {
    border-bottom: none;
    padding: 8px 0;
}

.required-docs-head {
    margin-bottom: 16px;
}

.required-docs-head h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 700;
}

.required-docs-head .muted { margin: 0; }

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* 竖向排列 */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 640px;
}

.doc-row {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.doc-row-done { border-color: #86efac; }
.doc-row-missing { border-color: #fcd34d; }

.doc-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.doc-row-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.doc-row-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.doc-file-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.doc-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 14px;
}

.doc-file-misplaced {
    background: #fffbeb !important;
    border-color: #fcd34d !important;
}

.doc-file-main {
    flex: 1;
    min-width: 0;
}

.doc-file-warn {
    display: block;
    font-size: 12px;
    color: #b45309;
    margin-top: 2px;
}

.doc-file-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.file-move-select {
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    max-width: 130px;
}

.doc-file-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.doc-file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.doc-file-uploader {
    color: #475569;
    font-weight: 500;
}

.doc-file-uploader::after {
    content: '·';
    margin-left: 8px;
    color: #cbd5e1;
    font-weight: 400;
}

.doc-file-size {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
}

.doc-file-delete {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.doc-file-delete:hover {
    background: #fee2e2;
    color: var(--danger);
}

.doc-dropzone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.doc-dropzone:hover,
.doc-dropzone.is-dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.doc-dropzone.is-uploading {
    pointer-events: none;
    opacity: 0.7;
}

.doc-dropzone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.doc-dropzone-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    text-align: center;
    pointer-events: none;
}

.doc-dropzone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 0;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    color: var(--primary);
    border: 1px solid var(--border);
}

.doc-dropzone-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.doc-dropzone-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

.doc-dropzone-progress {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

.doc-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-card-done { border-color: #86efac; background: linear-gradient(180deg, #f0fdf4 0%, #fff 40%); }
.doc-card-missing { border-color: #fcd34d; background: linear-gradient(180deg, #fffbeb 0%, #fff 40%); }

.doc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.doc-card-header h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
}

.doc-status {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}

.doc-status-ok { background: #dcfce7; color: #166534; }
.doc-status-no { background: #fef3c7; color: #92400e; }

.doc-empty {
    margin: 0;
    padding: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    background: #f8fafc;
    border-radius: 8px;
}

.upload-form-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 12px;
    margin-bottom: 0;
}

.upload-form-inline input[type="file"] {
    flex: 1;
    min-width: 0;
    font-size: 12px;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-waiting { background: #dbeafe; color: #1e40af; }
.badge-done { background: #dcfce7; color: #166534; }
.badge-docs-ready { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-docs-missing { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

.badge-ready { background: #dcfce7; color: #166534; }
.badge-draft { background: #fef3c7; color: #92400e; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

.amount-field,
.status-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.amount-field .btn {
    font-weight: 500;
    flex-shrink: 0;
}

.field-head .btn {
    flex-shrink: 0;
}

.status-field .badge {
    margin-left: 0;
}

.status-meta {
    font-size: 12px;
}

body.modal-open {
    overflow: hidden;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
    position: relative;
    width: min(420px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.modal-dialog h3 {
    margin: 0 0 8px;
}

.modal-dialog .field {
    margin-bottom: 16px;
}

.modal-dialog .field[hidden] {
    display: none;
}

.modal-dialog label.field > span {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.modal-dialog select,
.modal-dialog input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fafbfc;
}

.modal-dialog select:focus,
.modal-dialog input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.container-wide {
    width: min(1280px, 94vw);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.admin-stat-label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.admin-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

a.admin-stat-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.admin-stat-link:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

a.admin-stat-link .admin-stat-value {
    font-size: 1.25rem;
    color: var(--primary);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
}

.admin-panel-side {
    position: sticky;
    top: 88px;
}

.admin-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-panel-head h2 {
    margin: 0;
}

.admin-edit-panel {
    max-width: 720px;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
}

.admin-form-grid .form-actions {
    grid-column: 1 / -1;
}

.auth-card-wide {
    width: min(720px, 92vw);
    max-width: none;
}

.admin-panel h2 {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.user-card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.user-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
}

.user-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.user-card-identity {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.user-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.user-card-username {
    font-size: 13px;
    color: var(--muted);
    font-family: ui-monospace, Consolas, monospace;
}

.user-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.badge-plain {
    margin-left: 0;
}

.user-card-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
    padding: 14px 0;
    border-top: 1px solid #e8edf3;
    border-bottom: 1px solid #e8edf3;
}

.user-card-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.user-card-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.user-card-value {
    font-size: 14px;
    color: var(--text);
    word-break: break-all;
}

.user-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    flex-wrap: wrap;
}

.user-card-time {
    font-size: 12px;
}

.user-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-card-hint {
    font-size: 12px;
}

.inline-form {
    display: inline;
    margin: 0;
}

.admin-form select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fafbfc;
}

.password-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.password-field-row input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fafbfc;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.5;
}

.badge-admin { background: #ede9fe; color: #5b21b6; }
.badge-member { background: #f1f5f9; color: #475569; }

.badge-log-api { background: #dbeafe; color: #1e40af; }
.badge-log-business { background: #ecfdf5; color: #065f46; }
.badge-log-auth { background: #fef3c7; color: #92400e; }
.badge-log-user { background: #ede9fe; color: #5b21b6; }
.badge-log-page { background: #f1f5f9; color: #475569; }
.badge-log-security { background: #fee2e2; color: #991b1b; }
.badge-log-app { background: #f8fafc; color: #64748b; }

.admin-log-table { font-size: 13px; }
.admin-log-table td { vertical-align: top; }
.log-time { white-space: nowrap; font-size: 12px; }
.log-action { white-space: nowrap; font-weight: 600; }
.log-detail {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.log-role { display: block; font-size: 11px; }
.log-status { font-size: 11px; margin-left: 4px; }
.log-row-fail { background: #fffbeb; }
.log-case a { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.admin-settings-form {
    display: grid;
    gap: 20px;
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.settings-section-desc {
    margin: -8px 0 12px;
    font-size: 13px;
}

.settings-lines-field {
    display: block;
}

.settings-lines-field textarea {
    width: 100%;
    min-height: 240px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: #fafbfc;
}

.settings-lines-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.admin-settings-actions {
    padding-bottom: 8px;
}

.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 960px) {
    .admin-grid { grid-template-columns: 1fr; }
    .admin-panel-side { position: static; }
}

@media (max-width: 768px) {
    .container,
    .container-wide {
        width: 100%;
        padding: 16px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left));
    }

    /* Header */
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 0;
    }

    .brand {
        font-size: 1rem;
        line-height: 1.35;
    }

    .nav-links {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 8px;
        padding-bottom: 2px;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links > a:not(.btn),
    .nav-links > .user-info {
        flex-shrink: 0;
    }

    .nav-links > a:not(.btn) {
        font-size: 13px;
        padding: 8px 10px;
    }

    .user-info {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Page head */
    .page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }

    .page-head > div:first-child {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .page-head h1 {
        flex: 1 1 100%;
        font-size: 1.35rem;
        line-height: 1.35;
        word-break: break-word;
    }

    .page-head .badge {
        margin-left: 0;
    }

    .head-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .head-actions .btn {
        width: 100%;
        min-height: 44px;
        white-space: nowrap;
        padding-left: 10px;
        padding-right: 10px;
    }

    /* List & filter */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }

    .filter-bar input,
    .filter-status,
    .filter-bar select,
    .filter-bar .btn {
        width: 100%;
        min-width: 0;
    }

    .filter-bar .btn {
        min-height: 44px;
    }

    .batch-export-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .batch-export-bar .btn {
        width: 100%;
        min-height: 44px;
    }

    .case-grid {
        grid-template-columns: 1fr;
    }

    /* Forms */
    .form-page {
        padding: 8px 0 24px;
    }

    .form-card-header {
        padding: 24px 20px 8px;
    }

    .case-form {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    .form-actions .btn-primary {
        flex: none;
    }

    .upload-zone-body {
        padding: 20px 16px;
    }

    /* Detail panels */
    .detail-panel {
        padding: 16px;
    }

    .doc-row {
        padding: 14px 16px;
    }

    .doc-row-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .doc-row-header .btn {
        width: 100%;
        text-align: center;
        min-height: 40px;
    }

    .preview-panel-head {
        padding: 12px 14px 0;
    }

    .preview-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        margin: 0 -4px;
    }

    .preview-tabs::-webkit-scrollbar {
        display: none;
    }

    .preview-tab {
        flex: 0 0 auto;
        min-width: 96px;
        padding: 10px 12px;
        font-size: 12px;
    }

    .doc-file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .doc-file-tools {
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px solid rgba(15, 23, 42, 0.06);
    }

    .file-move-select {
        flex: 1;
        max-width: none;
        min-height: 36px;
    }

    .doc-file-delete {
        width: 36px;
        height: 36px;
    }

    .doc-dropzone-body {
        flex-wrap: wrap;
        padding: 10px;
        gap: 6px;
    }

    .doc-dropzone-text {
        font-size: 12px;
        text-align: left;
    }

    .status-meta {
        flex: 1 0 100%;
        line-height: 1.5;
    }

    /* Modal */
    .modal {
        padding: 12px;
        align-items: flex-end;
    }

    .modal-dialog {
        width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding: 20px 16px max(20px, env(safe-area-inset-bottom));
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    /* Admin */
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-panel-side {
        position: static;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-settings-grid {
        grid-template-columns: 1fr;
    }

    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
        padding-bottom: 4px;
    }

    .admin-log-table {
        min-width: 680px;
    }

    .user-card-fields {
        grid-template-columns: 1fr;
    }

    .user-card-foot {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .user-card-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .user-card-actions .btn,
    .user-card-actions form {
        flex: 1 1 calc(50% - 4px);
    }

    .user-card-actions .btn {
        min-height: 40px;
    }

    .password-field-row {
        flex-direction: column;
        align-items: stretch;
    }

    .password-field-row .btn {
        width: 100%;
        min-height: 40px;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-lg {
        min-width: 0;
    }

    .setup-main {
        width: 100%;
        padding: 12px 0 32px;
    }

    .setup-header,
    .setup-form {
        padding-left: 16px;
        padding-right: 16px;
    }

    .setup-header h1 {
        font-size: 1.35rem;
    }

    .auth-card {
        margin: 0 auto;
        padding: 20px 16px;
    }

    .auth-card-login {
        max-width: none;
    }

    .disclaimer-page-panel {
        padding: 16px;
    }

    .page-head-simple .head-actions {
        width: 100%;
    }

    .page-head-simple .head-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .page-head h1 {
        font-size: 1.2rem;
    }

    .head-actions {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .info-grid-status {
        padding-top: 12px;
    }

    .status-field {
        gap: 8px;
    }

    .case-card {
        padding: 16px;
    }

    .case-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .case-card-head h2 {
        font-size: 1rem;
    }

    .preview-area,
    .preview-frame,
    .preview-placeholder,
    .preview-loading {
        min-height: 280px;
        max-height: 65vh;
    }

    .nav-links .btn-sm {
        padding: 8px 12px;
    }

    .empty-state {
        padding: 40px 16px;
    }

    .setup-shell {
        padding: 12px;
    }
}

/* ── Onboarding guide ── */
.guide-replay-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 999px;
    font-weight: 700;
    color: var(--primary);
    border-color: #bfdbfe;
    background: #eff6ff;
}

.guide-replay-btn:hover {
    background: #dbeafe;
    border-color: var(--primary);
}

body.guide-open {
    overflow: hidden;
}

.guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.55);
}

.guide-overlay[hidden] {
    display: none !important;
}

.guide-spotlight {
    position: absolute;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
    background: transparent;
    pointer-events: none;
    transition: top 0.2s, left 0.2s, width 0.2s, height 0.2s;
    z-index: 2001;
}

.guide-popover {
    position: absolute;
    z-index: 2002;
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow-lg);
}

.guide-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.guide-step-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.guide-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}

.guide-popover-title {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
}

.guide-popover-text {
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.guide-popover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.guide-popover-actions .guide-next {
    margin-left: auto;
}

.guide-welcome {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.5);
}

.guide-welcome-dialog {
    width: min(480px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.guide-welcome-badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
}

.guide-welcome-dialog h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.guide-welcome-sub {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.guide-changelog {
    margin: 0 0 16px;
    padding-left: 1.2em;
    font-size: 14px;
    line-height: 1.7;
}

.guide-changelog li {
    margin-bottom: 4px;
}

.guide-pending {
    margin: 0 0 16px;
    font-size: 13px;
}

.guide-welcome-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.guide-welcome-actions .guide-start {
    flex: 1 1 100%;
    min-height: 44px;
}

@media (max-width: 768px) {
    .guide-welcome-actions {
        flex-direction: column;
    }

    .guide-welcome-actions .btn {
        width: 100%;
        min-height: 44px;
    }

    .guide-popover-actions {
        flex-direction: column;
    }

    .guide-popover-actions .btn {
        width: 100%;
        min-height: 40px;
    }

    .guide-popover-actions .guide-next {
        margin-left: 0;
    }
}

/* ── Team dashboard / meetings / members ── */
.brand-text {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dash-hero {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 28px;
    background: linear-gradient(135deg, #9a3412 0%, #c2410c 55%, #ea580c 100%);
    color: #fff7ed;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.dash-hero h1 {
    margin: 6px 0 8px;
    font-size: 1.8rem;
    color: #fff;
}

.dash-hero .muted { color: rgba(255, 247, 237, 0.82); }

.dash-kicker {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.85;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dash-kicker-logo {
    width: 28px;
    height: auto;
    display: block;
    background: #fff7ed;
    border-radius: 50%;
    padding: 2px;
}

.dash-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dash-hero-actions .btn {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}

.dash-hero-actions .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.dash-hero-actions .btn-primary {
    background: #fff;
    border-color: #fff;
    color: #9a3412;
    box-shadow: none;
}

.dash-hero-actions .btn-primary:hover {
    background: #fff7ed;
    color: #7c2d12;
}

.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.dash-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
}

.dash-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
}

.dash-stat-label {
    color: var(--muted);
    font-size: 13px;
}

.dash-stat strong {
    font-size: 1.7rem;
    letter-spacing: -0.04em;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dash-grid.dash-grid-main {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
}

.dash-grid.dash-grid-main > .dash-task-panel {
    grid-column: auto;
    min-width: 0;
    padding: 14px;
}

.dash-task-panel .panel-head-row {
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: flex-start;
}

.dash-task-panel .panel-head-row h2 {
    font-size: 1.05rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
}

.dash-task-panel .panel-head-row > a {
    flex-shrink: 0;
    font-size: 12px;
    white-space: nowrap;
}

.dash-side-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    min-width: 0;
}

.dash-task-week {
    margin: 2px 0 0;
    font-size: 12px;
}

.dash-tt-scroll {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fffaf8;
}

.dash-tt-board {
    --tt-slot: 32px;
    --tt-periods: 11;
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
}

.dash-tt-side {
    width: 28px;
    flex-shrink: 0;
    border-right: 1px solid #f1e8e4;
    background: #fffaf8;
}

.dash-tt-side-head,
.dash-tt-day-head {
    height: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    border-bottom: 1px solid #f1e8e4;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
}

.dash-tt-side-slot {
    height: var(--tt-slot);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3px;
    border-bottom: 1px solid #f1e8e4;
    box-sizing: border-box;
}

.dash-tt-period {
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.dash-tt-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    flex: 1;
    min-width: 0;
}

.dash-tt-day {
    border-right: 1px solid #f1e8e4;
    min-width: 0;
    background: #fffaf8;
}

.dash-tt-day:last-child { border-right: 0; }
.dash-tt-day.is-today { background: #fff5f0; }
.dash-tt-day.is-today .dash-tt-day-head {
    background: #ffe8dc;
    color: #c2410c;
}

.dash-tt-day-head strong {
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.dash-tt-day.is-today .dash-tt-day-head strong { color: #c2410c; }

.dash-tt-slots {
    position: relative;
    height: calc(var(--tt-periods) * var(--tt-slot));
}

.dash-tt-line {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--tt-i, 0) * var(--tt-slot));
    height: var(--tt-slot);
    border-bottom: 1px solid #f1e8e4;
    box-sizing: border-box;
    pointer-events: none;
}

.dash-tt-block {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 1px 0;
    border-radius: 3px;
    text-decoration: none;
    color: #1c1917;
    overflow: hidden;
    box-sizing: border-box;
}

.dash-tt-block:hover {
    text-decoration: none;
    color: #1c1917;
    filter: brightness(0.97);
}

.dash-tt-title {
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
    letter-spacing: -0.03em;
}

.dash-tt-foot {
    margin-top: auto;
    margin-left: -1px;
    margin-right: -1px;
    padding: 1px;
    font-size: 7px;
    font-weight: 600;
    text-align: center;
    background: rgba(28, 25, 23, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.04em;
}

.dash-tt-note {
    margin: 8px 0 0;
    font-size: 12px;
}

.tt-color-0 .dash-tt-foot { background: #fdba74; color: #7c2d12; }
.tt-color-1 .dash-tt-foot { background: #6ee7b7; color: #065f46; }
.tt-color-2 .dash-tt-foot { background: #93c5fd; color: #1e3a8a; }
.tt-color-3 .dash-tt-foot { background: #c4b5fd; color: #5b21b6; }
.tt-color-4 .dash-tt-foot { background: #f9a8d4; color: #9d174d; }
.tt-color-5 .dash-tt-foot { background: #fcd34d; color: #92400e; }

@media (max-width: 1100px) {
    .dash-side-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .dash-grid.dash-grid-main {
        grid-template-columns: 1fr;
    }
    .dash-task-panel {
        max-width: 420px;
    }
    .dash-tt-board { --tt-slot: 40px; min-width: 0; }
    .dash-tt-side { width: 26px; }
    .dash-tt-title { font-size: 9px; }
}

.panel-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-head-row h2 { margin: 0; }

.dash-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dash-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dash-list li + li {
    border-top: 1px solid var(--border);
}

.dash-list a {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    padding: 12px 0;
    color: inherit;
    text-decoration: none;
}

.project-attach-bar {
    align-items: center;
    margin-bottom: 16px;
}

.project-attach-bar select {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fafbfc;
}

.dash-list a:hover { color: var(--primary); }

.dash-list .btn-sm { flex-shrink: 0; }

.dash-list-title { font-weight: 600; }

.group-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.group-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--primary-light);
    color: #9a3412;
    text-decoration: none;
    font-size: 14px;
}

.group-pill:hover { color: #7c2d12; }

.form-page-wide { padding: 8px 0 32px; }
.form-card-wide { width: min(880px, 100%); }
.form-card-wide .case-form { padding: 12px 32px 32px; }

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

.field-row-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.time-range {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px 12px;
    align-items: end;
}

.time-range-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.time-range-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.time-range-join {
    padding-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.meeting-form .form-section .field:last-child {
    margin-bottom: 8px;
}

.meeting-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meeting-item {
    display: flex;
    gap: 16px;
    align-items: stretch;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.meeting-item:hover {
    color: inherit;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    border-color: #fdba74;
}

.meeting-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 10px 8px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffedd5 0%, #fff7ed 100%);
    color: #9a3412;
    line-height: 1.15;
}

.meeting-date-badge-lg {
    min-width: 84px;
    padding: 12px 10px;
}

.meeting-date-month,
.meeting-date-week {
    font-size: 11px;
    font-weight: 600;
}

.meeting-date-day {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.meeting-item-body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.meeting-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.meeting-item-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
    line-height: 1.4;
}

.meeting-item-meta,
.meeting-item-files {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.meeting-hero {
    display: flex;
    align-items: center;
    gap: 16px;
}

.meeting-hero h1 {
    margin: 0 0 4px;
}

.meeting-hero-meta {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 14px;
}

.meeting-hero .badge {
    margin-right: 6px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.photo-card {
    margin: 0;
    background: #faf7f2;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.photo-card img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #e7e0d6;
}

.photo-card figcaption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--muted);
}

.photo-card figcaption span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prose {
    white-space: pre-wrap;
    line-height: 1.75;
}

.meeting-summary {
    margin-top: 16px;
    padding: 12px 14px;
    background: #fff7ed;
    border-radius: 10px;
}

.name-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.name-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: #f5f0ea;
    font-size: 13px;
}

/* member picker (project form) */
.member-picker {
    display: grid;
    gap: 10px;
}
.member-picker-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #faf8f5;
}
.member-picker-placeholder {
    font-size: 13px;
    align-self: center;
}
.member-picker-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 12px;
    border: 0;
    border-radius: 999px;
    background: #ffedd5;
    color: #9a3412;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.member-picker-chip:hover {
    background: #fed7aa;
}
.member-picker-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(154, 52, 18, 0.12);
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
}
.member-picker-search {
    width: 100%;
}
.member-picker-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
}
.member-picker-toolbar .member-picker-search {
    flex: 1;
    min-width: 0;
}
.member-picker-add-custom {
    flex-shrink: 0;
    white-space: nowrap;
}
.member-picker-chip.is-custom {
    background: #fef3c7;
    color: #92400e;
}
.member-picker-chip.is-custom .member-picker-chip-x {
    background: rgba(146, 64, 14, 0.12);
}
.member-picker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 220px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}
.member-picker-option {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    min-height: 36px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.member-picker-option:hover:not(:disabled) {
    border-color: #fdba74;
    background: #fff7ed;
    color: #c2410c;
}
.member-picker-option.is-selected,
.member-picker-option:disabled {
    opacity: 0.45;
    cursor: default;
    background: #f5f0ea;
}
.member-picker-empty,
.member-picker-filter-empty {
    margin: 0;
    font-size: 13px;
    width: 100%;
}

.file-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.file-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.member-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.member-card-link {
    display: flex;
    gap: 14px;
    padding: 16px;
    color: inherit;
    text-decoration: none;
}

.member-card-link:hover { color: inherit; }

.member-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e7e0d6;
}

.member-avatar-lg {
    width: 84px;
    height: 84px;
    border-radius: 22px;
}

.member-avatar.is-croppable {
    cursor: pointer;
    box-shadow: 0 0 0 2px transparent;
    transition: box-shadow 0.15s;
}

.member-avatar.is-croppable:hover {
    box-shadow: 0 0 0 2px var(--primary);
}

.member-photo-preview {
    margin-bottom: 16px;
}

.member-photo-preview img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    background: #f4eee6;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.member-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.avatar-crop-dialog {
    width: min(760px, 100%);
}

.avatar-crop-dialog .muted {
    margin: 0 0 16px;
    font-size: 13px;
}

.avatar-crop-stage {
    display: flex;
    justify-content: center;
    background: #1c1917;
    border-radius: 12px;
    padding: 12px;
    max-height: min(62vh, 560px);
    overflow: hidden;
}

.avatar-crop-canvas {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    touch-action: none;
}

.avatar-crop-canvas img {
    display: block;
    max-width: 100%;
    max-height: min(56vh, 520px);
    user-select: none;
    -webkit-user-drag: none;
}

.avatar-crop-box {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    cursor: move;
    touch-action: none;
    box-sizing: border-box;
}

.avatar-crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 1px solid #c2410c;
    border-radius: 3px;
}

.avatar-crop-handle.nw { top: -7px; left: -7px; cursor: nwse-resize; }
.avatar-crop-handle.ne { top: -7px; right: -7px; cursor: nesw-resize; }
.avatar-crop-handle.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.avatar-crop-handle.se { bottom: -7px; right: -7px; cursor: nwse-resize; }

.member-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ea580c, #9a3412);
    color: #fff;
    font-weight: 700;
}

.member-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.member-card-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.member-card-body p { margin: 4px 0 0; }

.member-hero {
    display: flex;
    align-items: center;
    gap: 16px;
}

@media (max-width: 900px) {
    .dash-stats {
        grid-template-columns: 1fr 1fr;
    }
    .dash-grid:not(.dash-grid-main) {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .dash-stats,
    .dash-grid,
    .field-row,
    .field-row-2,
    .field-row-3,
    .time-range {
        grid-template-columns: 1fr;
    }

    .time-range-join {
        display: none;
    }

    .form-card-header-wide,
    .form-card-wide .case-form {
        padding-left: 20px;
        padding-right: 20px;
    }

    .meeting-item {
        padding: 12px;
    }

    .meeting-date-badge {
        min-width: 60px;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.drive-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    font-size: 14px;
}

.drive-crumbs a { color: var(--primary); text-decoration: none; }
.drive-crumbs a:hover { text-decoration: underline; }
.drive-crumb-sep { color: var(--muted); }

.drive-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.drive-toolbar label.btn {
    position: relative;
    margin: 0;
}

.drive-dropzone {
    margin-bottom: 16px;
    cursor: pointer;
}

.drive-table {
    width: 100%;
    border-collapse: collapse;
}

.drive-table th {
    text-align: left;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}

.drive-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.drive-name a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.drive-name a:hover { color: var(--primary); }
.drive-icon { font-size: 16px; }

.drive-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.drive-preview-frame {
    display: flex;
    justify-content: center;
    background: #faf8f5;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    max-height: 80vh;
}

.drive-preview-frame img {
    max-width: 100%;
    height: auto;
}

.drive-preview-pdf {
    width: 100%;
    min-height: 70vh;
    border: 0;
    display: block;
}

.drive-code {
    margin: 0;
    padding: 16px 18px;
    background: #1c1917;
    color: #f5f0ea;
    border-radius: var(--radius);
    overflow: auto;
    max-height: 75vh;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 800px) {
    .drive-table thead { display: none; }
    .drive-table tr {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
    }
    .drive-table td {
        display: block;
        padding: 2px 0;
        border: 0;
    }
    .drive-actions { justify-content: flex-start; }
}


.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    flex: 0 1 auto;
}

.nav-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover { background: #faf7f2; }
.nav-toggle-bars {
    display: block;
    width: 18px;
    height: 12px;
    background:
        linear-gradient(currentColor, currentColor) 0 0 / 100% 2px no-repeat,
        linear-gradient(currentColor, currentColor) 0 5px / 100% 2px no-repeat,
        linear-gradient(currentColor, currentColor) 0 10px / 100% 2px no-repeat;
}
.nav-toggle.is-open .nav-toggle-bars {
    height: 12px;
    background:
        linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
    box-shadow: none;
    position: relative;
}
.nav-toggle.is-open .nav-toggle-bars::before,
.nav-toggle.is-open .nav-toggle-bars::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 5px;
    height: 2px;
    background: currentColor;
}
.nav-toggle.is-open .nav-toggle-bars::before { transform: rotate(45deg); }
.nav-toggle.is-open .nav-toggle-bars::after { transform: rotate(-45deg); }


/* panel head actions */
.panel-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* nav denser for multi-module */
.header-inner.container-wide {
    width: min(1280px, 94vw);
}

.nav-links {
    gap: 6px 8px;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
}

.nav-links > a:not(.btn) {
    padding: 6px 8px;
    font-size: 13px;
}

.user-info {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* === tasks === */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.task-item-main { min-width: 0; flex: 1; }

.task-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.task-item-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 650;
}

.task-item-meta {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.task-item-desc { margin: 8px 0 0; }

.task-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.task-status-select {
    min-width: 110px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
}

.meeting-task-form {
    margin-bottom: 14px;
}

.meeting-task-form input[type="text"],
.meeting-task-form input[type="date"] {
    min-width: 0;
}

@media (max-width: 768px) {
    .task-item {
        flex-direction: column;
    }
    .task-item-actions {
        width: 100%;
    }
    .task-status-select {
        flex: 1;
    }
}


/* === task timetable (课表) === */
.view-toggle {
    display: inline-flex;
    padding: 3px;
    background: #e7e0d6;
    border-radius: 10px;
    gap: 2px;
}
.view-toggle-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
}
.view-toggle-btn:hover { color: var(--text); text-decoration: none; }
.view-toggle-btn.is-active {
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.timetable-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 20px;
}
.timetable-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.timetable-week-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.timetable-week-label {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 15px;
}
.timetable-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #faf7f2;
}
.timetable-board {
    --tt-slot: 58px;
    --tt-periods: 11;
    --tt-gap: 2px;
    display: flex;
    min-width: 820px;
}
.tt-side {
    width: 56px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: #fff;
}
.tt-side-head,
.tt-day-head {
    height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}
.tt-side-allday,
.tt-allday {
    min-height: 44px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.tt-side-allday {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
}
.tt-side-slot {
    height: var(--tt-slot);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 6px;
    border-bottom: 1px solid #edf2f7;
    box-sizing: border-box;
}
.tt-period-no {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.tt-period-clock {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
}
.tt-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(100px, 1fr));
    flex: 1;
    min-width: 0;
}
.tt-day-col { border-right: 1px solid var(--border); background: #fff; }
.tt-day-col:last-child { border-right: 0; }
.tt-day-col.is-today { background: #f8fbff; }
.tt-day-col.is-today .tt-day-head {
    background: #fff7ed;
    color: #9a3412;
}
.tt-weekday { font-size: 12px; }
.tt-weekday-short { display: none; }
.tt-daynum { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.1; }
.tt-day-col.is-today .tt-daynum { color: #9a3412; }

.tt-allday {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
    position: relative;
}
.tt-chip {
    display: block;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tt-slots {
    position: relative;
    height: calc(var(--tt-periods) * var(--tt-slot));
}
.tt-slot-line {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--tt-i, 0) * var(--tt-slot));
    height: var(--tt-slot);
    border-bottom: 1px solid #edf2f7;
    box-sizing: border-box;
}
.tt-add {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(194, 65, 12, 0.1);
    color: var(--primary);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
}
.tt-allday:hover .tt-add,
.tt-slot-line:hover .tt-add {
    display: inline-flex;
}
.tt-add-slot {
    position: absolute;
    right: 4px;
    top: 4px;
    z-index: 2;
}
.tt-block {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 6px 0;
    border-radius: 8px;
    text-decoration: none;
    color: #1e293b;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.06);
    transition: transform 0.12s, box-shadow 0.12s;
}
.tt-block:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: #1e293b;
}
.tt-block-title {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}
.tt-block-foot {
    margin-top: auto;
    margin-left: -6px;
    margin-right: -6px;
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(28, 25, 23, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tt-color-0 { background: #ffedd5; }
.tt-color-1 { background: #d1fae5; }
.tt-color-2 { background: #dbeafe; }
.tt-color-3 { background: #ede9fe; }
.tt-color-4 { background: #fce7f3; }
.tt-color-5 { background: #fef3c7; }
.tt-color-0 .tt-block-foot { background: #fdba74; color: #7c2d12; }
.tt-color-1 .tt-block-foot { background: #6ee7b7; color: #065f46; }
.tt-color-2 .tt-block-foot { background: #93c5fd; color: #1e3a8a; }
.tt-color-3 .tt-block-foot { background: #c4b5fd; color: #5b21b6; }
.tt-color-4 .tt-block-foot { background: #f9a8d4; color: #9d174d; }
.tt-color-5 .tt-block-foot { background: #fcd34d; color: #92400e; }
.tt-status-done { opacity: 0.72; }
.tt-status-cancelled { opacity: 0.45; filter: grayscale(0.4); }

.timetable-unscheduled {
    margin-top: 18px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.timetable-unscheduled h3 {
    margin: 0 0 4px;
    font-size: 15px;
}

.tt-mobile-only { display: none; }
.tt-desktop-only { display: block; }

.task-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

@media (max-width: 900px) {
    /* 紧凑整周课表：七列同屏，无横向滚动 */
    .timetable-panel {
        padding: 8px 0;
        border-radius: 10px;
    }
    .timetable-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 8px;
        margin-bottom: 8px;
        padding: 0 8px;
    }
    .timetable-week-nav {
        display: flex;
        gap: 4px;
        flex: 1;
        min-width: 0;
    }
    .timetable-week-nav .btn {
        flex: 1;
        justify-content: center;
        padding: 6px 4px;
        font-size: 12px;
    }
    .timetable-week-label {
        width: 100%;
        justify-content: center;
        text-align: center;
        gap: 6px;
        font-size: 13px;
    }
    .timetable-week-label .muted { font-size: 12px; }
    .timetable-scroll {
        overflow: hidden;
        border-radius: 8px;
        background: #fffaf8;
    }
    .timetable-board {
        --tt-slot: 46px;
        --tt-gap: 1px;
        min-width: 0;
        width: 100%;
    }
    .tt-side {
        width: 34px;
        background: #fffaf8;
    }
    .tt-side-head,
    .tt-day-head {
        height: 42px;
        font-size: 10px;
        gap: 1px;
        background: #fffaf8;
    }
    .tt-side-allday,
    .tt-allday {
        min-height: 28px;
        background: #fffaf8;
    }
    .tt-side-allday {
        font-size: 9px;
        letter-spacing: -0.02em;
    }
    .tt-side-slot {
        padding-top: 3px;
        border-bottom-color: #f1e8e4;
    }
    .tt-period-no {
        font-size: 11px;
        font-weight: 700;
    }
    .tt-period-clock {
        font-size: 8px;
        transform: scale(0.92);
        transform-origin: top center;
        margin-top: 0;
        letter-spacing: -0.04em;
        white-space: nowrap;
    }
    .tt-days {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
    .tt-day-col {
        border-right-color: #f1e8e4;
        background: #fffaf8;
        min-width: 0;
    }
    .tt-day-col.is-today { background: #fff5f0; }
    .tt-day-col.is-today .tt-day-head {
        background: #ffe8dc;
        color: #c2410c;
    }
    .tt-weekday-full { display: inline; }
    .tt-weekday-short { display: none; }
    .tt-weekday { font-size: 10px; font-weight: 600; white-space: nowrap; }
    .tt-daynum { font-size: 13px; font-weight: 800; }
    .tt-day-col.is-today .tt-daynum { color: #c2410c; }
    .tt-allday {
        gap: 2px;
        padding: 2px;
    }
    .tt-chip {
        padding: 2px 3px;
        border-radius: 3px;
        font-size: 9px;
    }
    .tt-slot-line { border-bottom-color: #f1e8e4; }
    .tt-add,
    .tt-add-slot {
        display: none !important;
    }
    .tt-block {
        padding: 3px 2px 0;
        border-radius: 4px;
        box-shadow: none;
    }
    .tt-block:hover {
        transform: none;
        box-shadow: none;
    }
    .tt-block-title {
        font-size: 10px;
        font-weight: 700;
        line-height: 1.25;
        -webkit-line-clamp: 5;
        letter-spacing: -0.02em;
        text-align: center;
    }
    .tt-block-foot {
        margin-left: -2px;
        margin-right: -2px;
        padding: 2px 2px;
        font-size: 8px;
        text-align: center;
        letter-spacing: -0.03em;
    }
    .tt-from-ical { outline: none; }
    .task-page-head { gap: 10px; }
    .task-head-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    .task-head-actions .view-toggle { margin-right: auto; }
    .task-head-actions > .btn {
        width: auto;
        min-width: 72px;
        flex: 0 0 auto;
    }
    .filter-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .filter-bar input[type="search"] { grid-column: 1 / -1; }
    .filter-bar .assignee-multi { grid-column: 1 / -1; }
    .filter-bar .btn { grid-column: 1 / -1; }
}

@media (max-width: 380px) {
    .timetable-board { --tt-slot: 42px; }
    .tt-side { width: 30px; }
    .tt-block-title { font-size: 9px; }
    .tt-period-clock { display: none; }
    .tt-weekday-full { display: none; }
    .tt-weekday-short { display: inline; }
}


.field input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    background: #faf7f2;
    font: inherit;
    font-size: 14px;
}
.tt-from-ical {
    outline: 1px dashed rgba(28, 25, 23, 0.12);
}

/* === mobile site nav (final overrides) === */
@media (max-width: 900px) {
    .site-header .nav-toggle {
        display: inline-flex !important;
    }
    .site-header .header-inner {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .site-header .header-bar {
        width: 100%;
        min-height: 44px;
    }
    .site-header .brand {
        max-width: calc(100% - 96px);
    }
    .site-header .nav-links:not(.is-open),
    .site-header .nav-links[hidden] {
        display: none !important;
    }
    .site-header .nav-links.is-open {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        gap: 4px !important;
        overflow: visible !important;
        margin-top: 10px;
        padding: 8px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #faf7f2;
    }
    .site-header .nav-links.is-open > a:not(.btn),
    .site-header .nav-links.is-open > .user-info {
        width: 100% !important;
        max-width: none !important;
        flex-shrink: 0;
        box-sizing: border-box;
    }
    .site-header .nav-links.is-open > a:not(.btn) {
        display: flex !important;
        align-items: center;
        min-height: 44px;
        padding: 12px 14px !important;
        font-size: 15px !important;
        font-weight: 600;
        border-radius: 10px;
        background: #fff;
        color: var(--text) !important;
        border: 1px solid transparent;
    }
    .site-header .nav-links.is-open > a:not(.btn):active,
    .site-header .nav-links.is-open > a:not(.btn):hover {
        background: #fff7ed;
        border-color: #fed7aa;
        color: #9a3412 !important;
    }
    .site-header .nav-links.is-open > a.nav-logout {
        color: #b91c1c !important;
    }
    .site-header .nav-links.is-open > .user-info {
        order: -1;
        margin-bottom: 4px;
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .site-header .nav-links.is-open > .guide-replay-btn {
        align-self: flex-start;
        min-width: 44px;
        min-height: 44px;
        margin-top: 4px;
    }
}

@media (min-width: 901px) {
    .site-header .nav-toggle {
        display: none !important;
    }
    .site-header .nav-links[hidden] {
        display: flex !important;
    }
}


