/* ──────────────────────────────────────────────────────────
   Design tokens
   ────────────────────────────────────────────────────────── */
:root {
    --cs-primary:          #2563eb;
    --cs-primary-hover:    #1d4ed8;
    --cs-primary-soft:     #eff4ff;

    --cs-sidebar-bg:       #0f172a;
    --cs-sidebar-hover:    #1e293b;
    --cs-sidebar-active:   #2563eb;
    --cs-sidebar-text:     #cbd5e1;
    --cs-sidebar-muted:    #64748b;
    --cs-sidebar-section:  #475569;

    --cs-body-bg:          #f6f8fb;
    --cs-surface:          #ffffff;
    --cs-surface-muted:    #f8fafc;
    --cs-border:           #e4e8ef;
    --cs-border-strong:    #cbd5e1;
    --cs-text:             #0f172a;
    --cs-text-strong:      #0b1220;
    --cs-muted:            #64748b;
    --cs-subtle:           #94a3b8;

    --cs-success:          #16a34a;
    --cs-success-soft:     #dcfce7;
    --cs-warning:          #d97706;
    --cs-warning-soft:     #fef3c7;
    --cs-danger:           #dc2626;
    --cs-danger-soft:      #fee2e2;
    --cs-info:             #0891b2;
    --cs-info-soft:        #cffafe;

    --cs-radius:           0.5rem;
    --cs-radius-sm:        0.375rem;
    --cs-radius-lg:        0.75rem;

    --cs-shadow-sm:        0 1px 2px rgba(15, 23, 42, 0.05);
    --cs-shadow:           0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);

    --cs-sidebar-width:    260px;
    --cs-topbar-height:    60px;

    --cs-font-mono:        ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
}

/* ──────────────────────────────────────────────────────────
   Base
   ────────────────────────────────────────────────────────── */
body {
    background-color: var(--cs-body-bg);
    color: var(--cs-text);
    font-size: 0.9375rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--cs-primary);
    text-decoration: none;
}
a:hover { color: var(--cs-primary-hover); text-decoration: underline; }

hr { border-color: var(--cs-border); opacity: 1; }

.text-muted { color: var(--cs-muted) !important; }
.text-subtle { color: var(--cs-subtle); }

.font-monospace, .font-mono { font-family: var(--cs-font-mono); }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ──────────────────────────────────────────────────────────
   Sidebar
   ────────────────────────────────────────────────────────── */
.app-sidebar {
    width: var(--cs-sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    background-color: var(--cs-sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.app-sidebar .sidebar-brand {
    padding: 1.1rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: #fff;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.app-sidebar .sidebar-brand:hover { color: #fff; text-decoration: none; }
.app-sidebar .sidebar-brand img { width: 30px; height: 30px; border-radius: 6px; }

.app-sidebar .sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.625rem;
    overflow-y: auto;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    margin-bottom: 2px;
    border-radius: var(--cs-radius-sm);
    color: var(--cs-sidebar-text);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}
.app-sidebar .nav-link:hover {
    color: #fff;
    background-color: var(--cs-sidebar-hover);
    text-decoration: none;
}
.app-sidebar .nav-link.active {
    color: #fff;
    background-color: var(--cs-sidebar-active);
    box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset;
}
.app-sidebar .nav-link .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}
.app-sidebar .nav-link .nav-icon svg { width: 18px; height: 18px; }

.app-sidebar .sidebar-section-label {
    padding: 1rem 0.75rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cs-sidebar-section);
}

.app-sidebar .sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.app-sidebar .sidebar-footer .user-name {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
}
.app-sidebar .sidebar-footer .user-role {
    color: var(--cs-sidebar-muted);
    font-size: 0.75rem;
    margin-top: 0.125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ──────────────────────────────────────────────────────────
   Main layout
   ────────────────────────────────────────────────────────── */
.app-main {
    margin-left: var(--cs-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: var(--cs-topbar-height);
    padding: 0 1.5rem;
    background-color: var(--cs-surface);
    border-bottom: 1px solid var(--cs-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.app-topbar .topbar-crumb {
    font-size: 0.875rem;
    color: var(--cs-muted);
    font-weight: 500;
}
.app-topbar .topbar-user {
    font-size: 0.875rem;
    color: var(--cs-text);
    font-weight: 500;
}

.app-content {
    padding: 1.75rem 1.75rem 3rem;
    flex: 1;
}

/* ──────────────────────────────────────────────────────────
   Cards / sections
   ────────────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
}
.card-header {
    background-color: var(--cs-surface);
    border-bottom: 1px solid var(--cs-border);
    padding: 0.875rem 1.25rem;
}
.card-body { padding: 1.25rem; }

.section-card {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    margin-bottom: 1.25rem;
}
.section-card + .section-card { margin-top: 0; }

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--cs-border);
}
.section-card-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--cs-text);
    letter-spacing: -0.01em;
}
.section-card-body { padding: 1.25rem; }
.section-card-body--flush { padding: 0; }

/* Tabbed variant: the section-card attaches directly under a nav-tabs row */
.section-card--tabbed {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 0;
}

/* Collection items (work order labor/parts rows) */
.collection-item {
    position: relative;
    padding: 1rem 2.5rem 0.5rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--cs-surface-muted);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
}
.collection-item:last-child { margin-bottom: 0; }
.collection-item-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--cs-muted);
    border-radius: var(--cs-radius-sm);
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.collection-item-remove:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--cs-danger, #dc2626);
}

/* ──────────────────────────────────────────────────────────
   Page head (title block + actions row)
   ────────────────────────────────────────────────────────── */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.25rem;
}
.page-head-text { min-width: 0; flex: 1 1 auto; }
.page-head-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--cs-radius-sm);
    background: var(--cs-primary-soft);
    color: var(--cs-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.page-head-icon svg { width: 22px; height: 22px; }
.page-head-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cs-muted);
    margin-bottom: 0.375rem;
}
.page-head-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cs-text-strong);
    margin: 0;
    letter-spacing: -0.015em;
    line-height: 1.2;
    word-break: break-word;
}
.page-head-subtitle {
    color: var(--cs-muted);
    margin: 0.25rem 0 0;
    font-size: 0.9375rem;
}
.page-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Legacy page-header kept for backward compatibility */
.page-header { margin-bottom: 1.25rem; }
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--cs-text-strong);
    letter-spacing: -0.015em;
}
.page-header p { color: var(--cs-muted); margin-bottom: 0; }

/* ──────────────────────────────────────────────────────────
   Toolbar (search + filters + primary action)
   ────────────────────────────────────────────────────────── */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 0.625rem 0.75rem;
    box-shadow: var(--cs-shadow-sm);
    margin-bottom: 1rem;
}
.toolbar-search {
    flex: 1 1 260px;
    min-width: 220px;
    position: relative;
}
.toolbar-search .form-control {
    padding-left: 2.25rem;
    height: 40px;
    background: var(--cs-surface);
    border-color: var(--cs-border);
}
.toolbar-search .form-control:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.toolbar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cs-subtle);
    pointer-events: none;
    display: inline-flex;
}
.toolbar-search-icon svg { width: 16px; height: 16px; }
.toolbar-filters { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.toolbar-filters .form-select {
    height: 40px;
    min-width: 160px;
    border-color: var(--cs-border);
}
.toolbar-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

@media (max-width: 575.98px) {
    .toolbar-actions { margin-left: 0; width: 100%; }
    .toolbar-actions .btn { flex: 1; }
}

/* ──────────────────────────────────────────────────────────
   Buttons
   ────────────────────────────────────────────────────────── */
.btn {
    font-weight: 500;
    border-radius: var(--cs-radius-sm);
    padding: 0.5rem 0.875rem;
    transition: background-color 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    line-height: 1.2;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
}
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg {
    padding: 0.625rem 1.125rem;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--cs-primary);
    border-color: var(--cs-primary);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--cs-primary-hover);
    border-color: var(--cs-primary-hover);
    color: #fff;
}
.btn-primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.btn-outline-primary {
    color: var(--cs-primary);
    border-color: var(--cs-border-strong);
    background-color: var(--cs-surface);
}
.btn-outline-primary:hover {
    background-color: var(--cs-primary-soft);
    color: var(--cs-primary-hover);
    border-color: var(--cs-primary);
}

.btn-outline-secondary {
    color: var(--cs-text);
    border-color: var(--cs-border-strong);
    background-color: var(--cs-surface);
}
.btn-outline-secondary:hover {
    background-color: var(--cs-surface-muted);
    color: var(--cs-text);
    border-color: var(--cs-border-strong);
}

.btn-outline-danger {
    color: var(--cs-danger);
    border-color: var(--cs-border-strong);
    background-color: var(--cs-surface);
}
.btn-outline-danger:hover {
    background-color: var(--cs-danger-soft);
    color: var(--cs-danger);
    border-color: var(--cs-danger);
}

.btn-icon {
    padding: 0.375rem;
    line-height: 0;
    width: 34px;
    height: 34px;
    justify-content: center;
}
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 0.25rem; }
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon.btn-sm svg { width: 14px; height: 14px; }

/* Kebab menu */
.action-kebab .btn {
    background: transparent;
    border-color: transparent;
    color: var(--cs-muted);
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
}
.action-kebab .btn:hover {
    background-color: var(--cs-surface-muted);
    color: var(--cs-text);
    border-color: var(--cs-border);
}
.action-kebab .dropdown-menu {
    border-color: var(--cs-border);
    box-shadow: var(--cs-shadow);
    border-radius: var(--cs-radius-sm);
    padding: 0.375rem;
    min-width: 180px;
}
.action-kebab .dropdown-item {
    border-radius: 0.25rem;
    padding: 0.4375rem 0.625rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.action-kebab .dropdown-item svg { width: 16px; height: 16px; }
.action-kebab .dropdown-item.text-danger:hover {
    background-color: var(--cs-danger-soft);
    color: var(--cs-danger);
}

/* Action bar (back link + primary/secondary actions) */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.action-bar-back a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--cs-muted);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.875rem;
}
.action-bar-back a:hover { color: var(--cs-text); text-decoration: none; }
.action-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ──────────────────────────────────────────────────────────
   Summary tiles (dashboard + show page headers)
   ────────────────────────────────────────────────────────── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.summary-tile {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    padding: 1rem 1.125rem;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}
.summary-tile-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--cs-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--cs-primary-soft);
    color: var(--cs-primary);
}
.summary-tile-icon svg { width: 20px; height: 20px; }
.summary-tile-icon--success { background: var(--cs-success-soft); color: var(--cs-success); }
.summary-tile-icon--warning { background: var(--cs-warning-soft); color: var(--cs-warning); }
.summary-tile-icon--info    { background: var(--cs-info-soft);    color: var(--cs-info); }
.summary-tile-icon--danger  { background: var(--cs-danger-soft);  color: var(--cs-danger); }

.summary-tile-text { min-width: 0; flex: 1; }
.summary-tile-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--cs-muted);
    margin-bottom: 0.25rem;
}
.summary-tile-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--cs-text-strong);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.summary-tile-meta {
    font-size: 0.8125rem;
    color: var(--cs-muted);
    margin-top: 0.25rem;
}

/* Hero summary (e.g. work order show) */
.hero-summary {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}
.hero-summary-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 0.875rem;
}
.hero-summary-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cs-muted);
}
.hero-summary-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--cs-text-strong);
    margin: 0;
    font-family: var(--cs-font-mono);
}
.hero-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.875rem 1.25rem;
}
.hero-summary-field {
    min-width: 0;
}
.hero-summary-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cs-muted);
    margin-bottom: 0.2rem;
}
.hero-summary-field-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--cs-text);
    word-break: break-word;
}
.hero-summary-field-value--strong {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--cs-text-strong);
    font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────
   Key/value list (replaces dl.row pattern)
   ────────────────────────────────────────────────────────── */
.kv-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
}
.kv-row {
    display: grid;
    grid-template-columns: minmax(130px, 35%) 1fr;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--cs-border);
    margin: 0;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row dt, .kv-row .kv-label {
    font-weight: 500;
    color: var(--cs-muted);
    font-size: 0.875rem;
    margin: 0;
}
.kv-row dd, .kv-row .kv-value {
    color: var(--cs-text);
    font-weight: 500;
    margin: 0;
    min-width: 0;
    word-break: break-word;
}

@media (max-width: 575.98px) {
    .kv-row { grid-template-columns: 1fr; gap: 0; padding: 0.5rem 0; }
}

/* ──────────────────────────────────────────────────────────
   Data tables
   ────────────────────────────────────────────────────────── */
.data-table {
    width: 100%;
    margin: 0;
}
.data-table thead th {
    background: var(--cs-surface-muted);
    border-bottom: 1px solid var(--cs-border);
    border-top: 0;
    color: var(--cs-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.625rem 0.75rem;
    white-space: nowrap;
}
.data-table tbody td {
    padding: 0.75rem 0.75rem;
    vertical-align: middle;
    border-top: 1px solid var(--cs-border);
    color: var(--cs-text);
}
.data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody tr:hover td { background-color: var(--cs-surface-muted); }

.data-table .col-primary a { color: var(--cs-text-strong); font-weight: 600; }
.data-table .col-primary a:hover { color: var(--cs-primary); }
.data-table .col-primary .col-primary-sub {
    display: block;
    font-size: 0.8125rem;
    color: var(--cs-muted);
    font-weight: 400;
    margin-top: 0.125rem;
}
.data-table .col-numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.data-table .col-mono {
    font-family: var(--cs-font-mono);
    font-size: 0.875rem;
    color: var(--cs-muted);
}
.data-table .col-actions {
    text-align: right;
    white-space: nowrap;
    width: 1%;
}
.data-table .col-actions .btn + .btn { margin-left: 0.25rem; }
.data-table th:first-child, .data-table td:first-child { padding-left: 1.25rem; }
.data-table th:last-child, .data-table td:last-child { padding-right: 1.25rem; }

/* ──────────────────────────────────────────────────────────
   Badges
   ────────────────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    padding: 0.3125em 0.625em;
    font-size: 0.75rem;
    border-radius: 999px;
    letter-spacing: 0.01em;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    white-space: nowrap;
}
.status-badge::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: currentColor;
    flex-shrink: 0;
}
.status-badge--draft    { background: #eef2f7;            color: #475569; }
.status-badge--open     { background: var(--cs-primary-soft); color: var(--cs-primary); }
.status-badge--progress { background: var(--cs-info-soft);    color: var(--cs-info); }
.status-badge--waiting  { background: var(--cs-warning-soft); color: var(--cs-warning); }
.status-badge--success  { background: var(--cs-success-soft); color: var(--cs-success); }
.status-badge--danger   { background: var(--cs-danger-soft);  color: var(--cs-danger); }
.status-badge--neutral  { background: #eef2f7;            color: #475569; }
.status-badge--dark     { background: #1e293b;            color: #e2e8f0; }

/* ──────────────────────────────────────────────────────────
   Forms
   ────────────────────────────────────────────────────────── */
.form-label {
    font-weight: 500;
    color: var(--cs-text);
    margin-bottom: 0.3125rem;
    font-size: 0.875rem;
}
.form-control, .form-select {
    border-color: var(--cs-border);
    border-radius: var(--cs-radius-sm);
    padding: 0.5rem 0.75rem;
    color: var(--cs-text);
    background-color: var(--cs-surface);
    transition: border-color 0.12s, box-shadow 0.12s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-control.is-invalid, .form-select.is-invalid {
    border-color: var(--cs-danger);
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.invalid-feedback {
    display: block;
    color: var(--cs-danger);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}
textarea.form-control { min-height: 88px; }

.form-section {
    padding: 1.25rem;
    border-bottom: 1px solid var(--cs-border);
}
.form-section:last-of-type { border-bottom: 0; }
.form-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cs-muted);
    margin: 0 0 0.875rem;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--cs-surface-muted);
    border-top: 1px solid var(--cs-border);
    border-bottom-left-radius: var(--cs-radius);
    border-bottom-right-radius: var(--cs-radius);
}
.form-footer .btn { min-width: 110px; justify-content: center; }

/* Sticky form footer for long forms */
.form-footer-sticky {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 1rem;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    background: var(--cs-surface);
    box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.06);
}

/* ──────────────────────────────────────────────────────────
   Tabs
   ────────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 1px solid var(--cs-border);
    gap: 0.125rem;
}
.nav-tabs .nav-link {
    color: var(--cs-muted);
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.625rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: -1px;
}
.nav-tabs .nav-link:hover {
    color: var(--cs-text);
    background: transparent;
    border-bottom-color: var(--cs-border-strong);
}
.nav-tabs .nav-link.active {
    color: var(--cs-primary);
    background: transparent;
    border-bottom-color: var(--cs-primary);
}
.nav-tabs .nav-link .badge { margin-left: 0.375rem; }

/* ──────────────────────────────────────────────────────────
   Alerts / flash
   ────────────────────────────────────────────────────────── */
.alert {
    border: 1px solid transparent;
    border-radius: var(--cs-radius-sm);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--cs-success-soft); border-color: #86efac; color: #166534; }
.alert-danger  { background: var(--cs-danger-soft);  border-color: #fca5a5; color: #991b1b; }
.alert-warning { background: var(--cs-warning-soft); border-color: #fcd34d; color: #854d0e; }
.alert-info    { background: var(--cs-info-soft);    border-color: #67e8f9; color: #155e75; }

/* ──────────────────────────────────────────────────────────
   Empty state
   ────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--cs-muted);
}
.empty-state .empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.75rem;
    border-radius: var(--cs-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cs-primary-soft);
    color: var(--cs-primary);
}
.empty-state .empty-icon svg { width: 22px; height: 22px; }
.empty-state-title {
    color: var(--cs-text);
    font-weight: 600;
    font-size: 1rem;
    margin: 0 0 0.25rem;
}
.empty-state-text { margin: 0 0 0.875rem; }

/* ──────────────────────────────────────────────────────────
   Stat icon (legacy — kept for old dashboard)
   ────────────────────────────────────────────────────────── */
.stat-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--cs-radius-sm);
    font-size: 1.25rem;
}

/* ──────────────────────────────────────────────────────────
   Totals list (work order / offer)
   ────────────────────────────────────────────────────────── */
.totals-card {
    max-width: 420px;
    margin-left: auto;
}
.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0;
    color: var(--cs-muted);
    font-size: 0.9375rem;
}
.totals-row + .totals-row {
    border-top: 1px solid var(--cs-border-subtle, rgba(0, 0, 0, 0.06));
}
.totals-row .totals-value {
    color: var(--cs-text);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    white-space: nowrap;
}
.totals-row.totals-total {
    border-top: 1px solid var(--cs-border);
    padding-top: 0.875rem;
    margin-top: 0.25rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--cs-text-strong);
}
.totals-row.totals-total .totals-value {
    color: var(--cs-text-strong);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ──────────────────────────────────────────────────────────
   Login
   ────────────────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--cs-body-bg) 0%, #e8eef7 100%);
    padding: 2rem 1rem;
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem 2rem 1.75rem;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-lg);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    background: var(--cs-surface);
}
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cs-text-strong);
    letter-spacing: -0.01em;
}
.login-brand img { width: 40px; height: 40px; border-radius: 8px; }
.login-title {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.25rem;
    color: var(--cs-text-strong);
}
.login-subtitle {
    text-align: center;
    color: var(--cs-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}
/* ──────────────────────────────────────────────────────────
   Language switcher
   ────────────────────────────────────────────────────────── */
.language-switcher .btn {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.language-switcher .dropdown-item.active,
.language-switcher .dropdown-item:active {
    background-color: var(--cs-primary-soft);
    color: var(--cs-primary);
}

/* Form-field variant — full width, shaped to match adjacent text inputs. */
.language-switcher-form-field { width: 100%; }
.language-switcher-form-field .language-switcher-trigger {
    width: 100%;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
    color: var(--cs-text);
    background-color: var(--cs-surface);
}
.language-switcher-form-field .language-switcher-trigger::after { display: none; }
.language-switcher-form-field .dropdown-menu { padding: 0.25rem; }
.language-switcher-form-field .dropdown-item {
    border-radius: var(--cs-radius-sm);
    padding: 0.5rem 0.75rem;
}

/* ──────────────────────────────────────────────────────────
   Global header search
   ────────────────────────────────────────────────────────── */
.global-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 480px;
    min-width: 200px;
}
.global-search-input-wrap {
    position: relative;
}
.global-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cs-subtle);
    pointer-events: none;
    display: inline-flex;
}
.global-search-icon svg { width: 16px; height: 16px; }
.global-search .form-control {
    height: 38px;
    padding-left: 2.25rem;
    background: var(--cs-surface-muted);
    border-color: var(--cs-border);
}
.global-search .form-control:focus {
    background: var(--cs-surface);
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.global-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
    padding: 0.375rem 0;
    max-height: 70vh;
    overflow-y: auto;
}
.global-search.is-open .global-search-results { display: block; }

.global-search-group + .global-search-group {
    border-top: 1px solid var(--cs-border);
    margin-top: 0.25rem;
    padding-top: 0.25rem;
}
.global-search-group-label {
    padding: 0.375rem 0.875rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cs-muted);
}
.global-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.global-search-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem 0.875rem;
    color: var(--cs-text);
    text-decoration: none;
    border-radius: 0;
}
.global-search-item:hover,
.global-search-item:focus {
    background: var(--cs-primary-soft);
    color: var(--cs-text-strong);
    text-decoration: none;
}
.global-search-item-label {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--cs-text-strong);
    line-height: 1.2;
}
.global-search-item-description {
    font-size: 0.8125rem;
    color: var(--cs-muted);
    line-height: 1.2;
}

.global-search-hint {
    padding: 0.75rem 0.875rem;
    color: var(--cs-muted);
    font-size: 0.875rem;
    text-align: center;
}

@media (max-width: 575.98px) {
    .global-search { max-width: none; }
}

/* ──────────────────────────────────────────────────────────
   Sidebar toggle (mobile)
   ────────────────────────────────────────────────────────── */
.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius-sm);
    color: var(--cs-text);
    padding: 0.375rem;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle svg { width: 18px; height: 18px; }

/* ──────────────────────────────────────────────────────────
   Dashboard calendar
   ────────────────────────────────────────────────────────── */
.dashboard-calendar {
    font-size: 0.875rem;
}
.dashboard-calendar .fc-toolbar-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--cs-text-strong);
}
.dashboard-calendar .fc-event {
    cursor: pointer;
    border-radius: 0.25rem;
    padding: 0.125rem 0.375rem;
    border: 0;
    font-weight: 500;
    font-size: 0.75rem;
}
.dashboard-calendar .fc-button {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border-strong);
    color: var(--cs-text);
    font-weight: 500;
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
    box-shadow: none;
    text-transform: capitalize;
}
.dashboard-calendar .fc-button:hover {
    background: var(--cs-surface-muted);
    border-color: var(--cs-border-strong);
    color: var(--cs-text);
}
.dashboard-calendar .fc-button-primary:not(:disabled).fc-button-active,
.dashboard-calendar .fc-button-primary:not(:disabled):active {
    background: var(--cs-primary);
    border-color: var(--cs-primary);
    color: #fff;
}
.dashboard-calendar .fc-col-header-cell-cushion {
    color: var(--cs-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0;
}
.dashboard-calendar .fc-daygrid-day-number {
    color: var(--cs-text);
    font-weight: 500;
    padding: 0.375rem;
}
.dashboard-calendar .fc-day-today {
    background: var(--cs-primary-soft) !important;
}

/* ──────────────────────────────────────────────────────────
   Settings page
   ────────────────────────────────────────────────────────── */
.settings-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}
.settings-sidebar {
    position: sticky;
    top: 1rem;
}
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 0.5rem;
}
.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    color: var(--cs-text);
    text-decoration: none;
    border-radius: var(--cs-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 120ms ease, color 120ms ease;
}
.settings-nav-item:hover {
    background: var(--cs-surface-muted);
    color: var(--cs-text-strong);
    text-decoration: none;
}
.settings-nav-item.is-active {
    background: var(--cs-primary-soft);
    color: var(--cs-primary);
}
.settings-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}
.form-section-help {
    margin: 0 0 0.875rem;
    color: var(--cs-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}
@media (max-width: 767.98px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-sidebar { position: static; }
    .settings-nav { flex-direction: row; flex-wrap: wrap; }
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.settings-tile {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
    border-radius: var(--cs-radius);
    padding: 1.125rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.settings-tile:hover:not(.settings-tile--disabled) {
    border-color: var(--cs-primary);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.10);
    color: inherit;
    text-decoration: none;
}
.settings-tile--disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.settings-tile-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--cs-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--cs-primary-soft);
    color: var(--cs-primary);
}
.settings-tile-text { min-width: 0; flex: 1; }
.settings-tile-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--cs-text-strong);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.settings-tile-description {
    font-size: 0.8125rem;
    color: var(--cs-muted);
    line-height: 1.4;
}

.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cs-surface-muted);
    border: 1px dashed var(--cs-border);
    border-radius: var(--cs-radius-sm);
    padding: 1rem;
    min-height: 120px;
    margin-bottom: 0.875rem;
}
.logo-preview img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
}
.logo-preview-empty {
    color: var(--cs-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--cs-radius-sm);
    background: var(--cs-surface);
    border: 1px solid var(--cs-border);
}

/* ──────────────────────────────────────────────────────────
   Statistics dashboard
   ────────────────────────────────────────────────────────── */
.statistics-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.statistics-chart {
    position: relative;
    height: 260px;
}
.statistics-charts-grid .section-card { margin-bottom: 0; }
.statistics-filter .toolbar-filters {
    flex: 1 1 auto;
    flex-wrap: wrap;
}
.statistics-filter .toolbar-filters .form-control {
    height: 40px;
    min-width: 160px;
}
.statistics-filter-custom {
    flex-wrap: wrap;
}

/* ──────────────────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        z-index: 1029;
        display: none;
    }
    .sidebar-backdrop.show { display: block; }

    .app-content { padding: 1rem 1rem 2.5rem; }
    .page-head-title { font-size: 1.25rem; }
}

@media (max-width: 575.98px) {
    .hero-summary { padding: 1rem; }
    .hero-summary-title { font-size: 1.25rem; }
}

/* iOS 主题 */
/* ──────────────────────────────────────────────────────────
   iOS 苹果风格 H5 主题
   ────────────────────────────────────────────────────────── */

/* iOS 系统颜色 */
:root {
    --ios-blue: #007AFF;
    --ios-blue-dark: #0056CC;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-yellow: #FFCC00;
    --ios-purple: #AF52DE;
    --ios-gray: #8E8E93;
    --ios-gray2: #AEAEB2;
    --ios-gray3: #C7C7CC;
    --ios-gray4: #D1D1D6;
    --ios-gray5: #E5E5EA;
    --ios-gray6: #F2F2F7;
    --ios-bg: #F2F2F7;
    --ios-card-bg: #FFFFFF;
    --ios-separator: rgba(60, 60, 67, 0.12);
    --ios-label: #000000;
    --ios-label-secondary: rgba(60, 60, 67, 0.6);
    --ios-label-tertiary: rgba(60, 60, 67, 0.3);
    --ios-radius: 12px;
    --ios-radius-lg: 16px;
    --ios-radius-xl: 20px;
    --ios-tabbar-height: 83px;
    --ios-navbar-height: 44px;
    --ios-large-title-height: 52px;
}

/* 仅在移动端启用 iOS 主题 */
@media (max-width: 991.98px) {
    /* 重置基础样式 */
    body {
        background-color: var(--ios-bg);
        color: var(--ios-label);
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
        font-size: 17px;
        line-height: 1.47;
        -webkit-font-smoothing: antialiased;
        padding-bottom: var(--ios-tabbar-height);
    }

    /* 隐藏原侧边栏和顶部栏 */
    .app-sidebar {
        display: none !important;
    }
    .app-topbar {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
    }
    .sidebar-toggle {
        display: none !important;
    }
    .sidebar-backdrop {
        display: none !important;
    }

    /* iOS 顶部导航栏 */
    .ios-nav-bar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(242, 242, 247, 0.82);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-bottom: 0.5px solid var(--ios-separator);
        padding-top: env(safe-area-inset-top);
    }
    .ios-nav-bar-content {
        height: var(--ios-navbar-height);
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        padding: 0 16px;
    }
    .ios-nav-bar-title {
        font-size: 17px;
        font-weight: 600;
        color: var(--ios-label);
    }
    .ios-nav-bar-left,
    .ios-nav-bar-right {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        gap: 16px;
    }
    .ios-nav-bar-left { left: 16px; }
    .ios-nav-bar-right { right: 16px; }
    .ios-nav-bar a,
    .ios-nav-bar button {
        color: var(--ios-blue);
        font-size: 17px;
        font-weight: 400;
        text-decoration: none;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .ios-nav-bar a:active,
    .ios-nav-bar button:active {
        opacity: 0.4;
    }

    /* iOS 大标题 */
    .ios-large-title {
        padding: 8px 20px 12px;
        background: var(--ios-bg);
    }
    .ios-large-title h1 {
        font-size: 34px;
        font-weight: 700;
        color: var(--ios-label);
        margin: 0;
        letter-spacing: -0.5px;
        line-height: 1.1;
    }
    .ios-large-title p {
        font-size: 15px;
        color: var(--ios-label-secondary);
        margin: 4px 0 0;
    }

    /* 主内容区 */
    .app-content {
        padding: calc(var(--ios-navbar-height) + env(safe-area-inset-top) + 8px) 0 calc(var(--ios-tabbar-height) + env(safe-area-inset-bottom)) !important;
        max-width: 100%;
    }

    /* iOS 分组列表 */
    .ios-group {
        margin: 20px 16px;
    }
    .ios-group-header {
        font-size: 13px;
        font-weight: 400;
        color: var(--ios-label-secondary);
        text-transform: uppercase;
        letter-spacing: -0.08px;
        padding: 0 16px 6px;
    }
    .ios-group-footer {
        font-size: 13px;
        color: var(--ios-label-secondary);
        padding: 6px 16px 0;
    }
    .ios-list {
        background: var(--ios-card-bg);
        border-radius: var(--ios-radius);
        overflow: hidden;
    }
    .ios-list-item {
        display: flex;
        align-items: center;
        padding: 12px 16px;
        min-height: 44px;
        border-bottom: 0.5px solid var(--ios-separator);
        background: var(--ios-card-bg);
        transition: background-color 0.15s;
    }
    .ios-list-item:last-child {
        border-bottom: none;
    }
    .ios-list-item:active {
        background-color: var(--ios-gray5);
    }
    .ios-list-item-icon {
        width: 30px;
        height: 30px;
        border-radius: 7px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 12px;
        flex-shrink: 0;
        color: #fff;
    }
    .ios-list-item-icon svg {
        width: 18px;
        height: 18px;
    }
    .ios-list-item-content {
        flex: 1;
        min-width: 0;
    }
    .ios-list-item-title {
        font-size: 17px;
        color: var(--ios-label);
        font-weight: 400;
    }
    .ios-list-item-subtitle {
        font-size: 14px;
        color: var(--ios-label-secondary);
        margin-top: 1px;
    }
    .ios-list-item-value {
        font-size: 17px;
        color: var(--ios-label-secondary);
        margin-right: 4px;
    }
    .ios-list-item-badge {
        background: var(--ios-red);
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        min-width: 20px;
        height: 20px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 6px;
        margin-right: 4px;
    }
    .ios-list-item-arrow {
        color: var(--ios-gray3);
        margin-left: 4px;
        flex-shrink: 0;
    }
    .ios-list-item-arrow svg {
        width: 12px;
        height: 12px;
    }

    /* iOS 卡片 */
    .ios-card {
        background: var(--ios-card-bg);
        border-radius: var(--ios-radius-lg);
        margin: 16px;
        padding: 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    /* iOS 按钮 */
    .ios-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 50px;
        border-radius: var(--ios-radius);
        font-size: 17px;
        font-weight: 600;
        border: none;
        cursor: pointer;
        transition: opacity 0.15s, transform 0.15s;
        text-decoration: none;
    }
    .ios-btn:active {
        opacity: 0.6;
        transform: scale(0.98);
    }
    .ios-btn-primary {
        background: var(--ios-blue);
        color: #fff;
    }
    .ios-btn-secondary {
        background: var(--ios-gray5);
        color: var(--ios-blue);
    }
    .ios-btn-danger {
        background: var(--ios-red);
        color: #fff;
    }

    /* iOS 底部标签栏 */
    .ios-tab-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.82);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        border-top: 0.5px solid var(--ios-separator);
        padding-bottom: env(safe-area-inset-bottom);
        display: flex;
        justify-content: space-around;
        align-items: flex-start;
        height: var(--ios-tabbar-height);
    }
    .ios-tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding-top: 6px;
        height: 49px;
        text-decoration: none;
        color: var(--ios-gray);
        transition: color 0.15s;
        position: relative;
    }
    .ios-tab-item.active {
        color: var(--ios-blue);
    }
    .ios-tab-item:active {
        opacity: 0.5;
    }
    .ios-tab-item svg {
        width: 26px;
        height: 26px;
        margin-bottom: 2px;
    }
    .ios-tab-item span {
        font-size: 10px;
        font-weight: 500;
        letter-spacing: 0.1px;
    }
    .ios-tab-item .ios-tab-badge {
        position: absolute;
        top: 2px;
        right: 50%;
        transform: translateX(16px);
        background: var(--ios-red);
        color: #fff;
        font-size: 11px;
        font-weight: 600;
        min-width: 18px;
        height: 18px;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 5px;
    }

    /* 覆盖原有组件样式为 iOS 风格 */

    /* 页面标题 */
    .page-head {
        display: none;
    }

    /* 统计卡片 - iOS 风格 */
    .summary-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 16px;
        margin: 0 0 20px;
    }
    .summary-tile {
        background: var(--ios-card-bg);
        border: none;
        border-radius: var(--ios-radius-lg);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .summary-tile-icon {
        width: 36px;
        height: 36px;
        border-radius: 9px;
    }
    .summary-tile-icon svg {
        width: 20px;
        height: 20px;
    }
    .summary-tile-label {
        font-size: 13px;
        color: var(--ios-label-secondary);
        font-weight: 400;
    }
    .summary-tile-value {
        font-size: 28px;
        font-weight: 700;
        color: var(--ios-label);
        letter-spacing: -0.5px;
    }

    /* 工具栏 */
    .toolbar {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0 16px;
        margin-bottom: 16px;
        gap: 8px;
    }
    .toolbar-search {
        flex: 1 1 100%;
        min-width: 0;
    }
    .toolbar-search .form-control {
        height: 36px;
        border-radius: 10px;
        background: var(--ios-gray5);
        border: none;
        font-size: 15px;
        padding-left: 36px;
    }
    .toolbar-search .form-control:focus {
        background: #fff;
        box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
    }
    .toolbar-search-icon {
        left: 12px;
        color: var(--ios-gray);
    }
    .toolbar-filters .form-select {
        height: 36px;
        border-radius: 10px;
        background: var(--ios-gray5);
        border: none;
        font-size: 15px;
    }
    .toolbar-actions {
        width: 100%;
    }
    .toolbar-actions .btn {
        flex: 1;
        height: 44px;
        border-radius: 10px;
        font-size: 16px;
        font-weight: 600;
        background: var(--ios-blue);
        border-color: var(--ios-blue);
    }

    /* 数据表格 - iOS 列表风格 */
    .section-card {
        background: transparent;
        border: none;
        box-shadow: none;
        margin: 0 16px 20px;
    }
    .section-card-header {
        background: transparent;
        border: none;
        padding: 0 0 8px;
    }
    .section-card-title {
        font-size: 22px;
        font-weight: 700;
        color: var(--ios-label);
    }
    .section-card-body {
        padding: 0;
    }
    .section-card--tabbed {
        border-radius: 0;
    }

    /* 表格转为 iOS 列表 */
    .data-table {
        display: block;
    }
    .data-table thead {
        display: none;
    }
    .data-table tbody {
        display: block;
    }
    .data-table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--ios-card-bg);
        border-radius: var(--ios-radius);
        margin-bottom: 10px;
        padding: 12px 16px;
        border: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .data-table tbody tr:hover td {
        background: transparent;
    }
    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-top: none;
        gap: 12px;
        font-size: 15px;
    }
    .data-table tbody td::before {
        content: attr(data-label);
        font-size: 14px;
        color: var(--ios-label-secondary);
        font-weight: 400;
        text-transform: none;
        letter-spacing: 0;
        flex-shrink: 0;
    }
    .data-table tbody td.col-actions {
        justify-content: flex-end;
        padding-top: 10px;
        margin-top: 4px;
        border-top: 0.5px solid var(--ios-separator);
    }
    .data-table tbody td.col-actions::before {
        display: none;
    }
    .data-table .col-primary a {
        font-size: 17px;
        font-weight: 600;
        color: var(--ios-label);
    }
    .data-table .col-numeric {
        font-weight: 600;
    }
    .data-table th:first-child,
    .data-table td:first-child,
    .data-table th:last-child,
    .data-table td:last-child {
        padding-left: 0;
        padding-right: 0;
    }

    /* 按钮 iOS 风格 */
    .btn {
        border-radius: 10px;
        font-size: 16px;
        font-weight: 600;
        padding: 10px 16px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .btn-primary {
        background: var(--ios-blue);
        border-color: var(--ios-blue);
    }
    .btn-primary:hover {
        background: var(--ios-blue-dark);
        border-color: var(--ios-blue-dark);
    }
    .btn-outline-primary,
    .btn-outline-secondary {
        background: var(--ios-gray5);
        border-color: transparent;
        color: var(--ios-blue);
    }
    .btn-outline-primary:hover,
    .btn-outline-secondary:hover {
        background: var(--ios-gray4);
        color: var(--ios-blue);
        border-color: transparent;
    }
    .btn-outline-danger {
        background: var(--ios-gray5);
        border-color: transparent;
        color: var(--ios-red);
    }
    .btn-sm {
        min-height: 32px;
        padding: 6px 12px;
        font-size: 14px;
        border-radius: 8px;
    }

    /* 表单 iOS 风格 */
    .form-label {
        font-size: 14px;
        font-weight: 500;
        color: var(--ios-label-secondary);
        margin-bottom: 6px;
    }
    .form-control,
    .form-select {
        border: none;
        border-radius: 10px;
        background: var(--ios-card-bg);
        padding: 12px 14px;
        font-size: 16px;
        color: var(--ios-label);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
        border-color: var(--ios-blue);
    }
    textarea.form-control {
        min-height: 100px;
    }
    .form-section {
        background: var(--ios-card-bg);
        border-radius: var(--ios-radius);
        margin: 16px;
        padding: 16px;
        border-bottom: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .form-section-title {
        font-size: 13px;
        font-weight: 400;
        color: var(--ios-label-secondary);
        text-transform: uppercase;
        letter-spacing: -0.08px;
        margin-bottom: 12px;
    }
    .form-footer {
        background: transparent;
        border: none;
        padding: 16px;
        flex-direction: column;
        gap: 10px;
    }
    .form-footer .btn {
        width: 100%;
        height: 50px;
        font-size: 17px;
        border-radius: var(--ios-radius);
    }

    /* 标签页 iOS 风格 */
    .nav-tabs {
        background: var(--ios-gray5);
        border-radius: 9px;
        padding: 2px;
        margin: 0 16px 16px;
        border-bottom: none;
        gap: 0;
        flex-wrap: nowrap;
    }
    .nav-tabs .nav-link {
        flex: 1;
        text-align: center;
        border-radius: 7px;
        padding: 7px 12px;
        font-size: 14px;
        font-weight: 500;
        color: var(--ios-label);
        border-bottom: none !important;
        white-space: nowrap;
    }
    .nav-tabs .nav-link:hover {
        background: transparent;
        color: var(--ios-label);
    }
    .nav-tabs .nav-link.active {
        background: #fff;
        color: var(--ios-label);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    /* 徽章 iOS 风格 */
    .badge,
    .status-badge {
        border-radius: 8px;
        font-size: 13px;
        font-weight: 500;
        padding: 4px 10px;
    }
    .status-badge::before {
        width: 6px;
        height: 6px;
    }

    /* 空状态 iOS 风格 */
    .empty-state {
        padding: 60px 20px;
    }
    .empty-state .empty-icon {
        width: 56px;
        height: 56px;
        border-radius: 14px;
        background: var(--ios-gray5);
        color: var(--ios-gray);
        margin-bottom: 16px;
    }
    .empty-state .empty-icon svg {
        width: 28px;
        height: 28px;
    }
    .empty-state-title {
        font-size: 20px;
        font-weight: 600;
        margin-bottom: 8px;
    }
    .empty-state-text {
        font-size: 15px;
        color: var(--ios-label-secondary);
        margin-bottom: 20px;
    }

    /* Hero 摘要 iOS 风格 */
    .hero-summary {
        background: var(--ios-card-bg);
        border: none;
        border-radius: var(--ios-radius-lg);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
        margin: 0 16px 16px;
        padding: 16px;
    }
    .hero-summary-title {
        font-size: 22px;
        font-family: inherit;
    }
    .hero-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .hero-summary-field-label {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0;
    }

    /* 合计卡片 iOS 风格 */
    .totals-card {
        max-width: 100%;
        background: var(--ios-card-bg);
        border-radius: var(--ios-radius-lg);
        padding: 16px;
        margin: 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    /* 集合项目 iOS 风格 */
    .collection-item {
        background: var(--ios-gray6);
        border: none;
        border-radius: var(--ios-radius);
        padding: 12px 40px 8px 12px;
    }

    /* 操作栏 iOS 风格 */
    .action-bar {
        padding: 0 16px;
        margin-bottom: 16px;
    }
    .action-bar-actions {
        width: 100%;
    }
    .action-bar-actions .btn {
        flex: 1;
    }

    /* 下拉菜单 iOS 风格 */
    .dropdown-menu {
        border-radius: var(--ios-radius);
        border: none;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        padding: 6px;
    }
    .dropdown-item {
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .dropdown-item:active {
        background: var(--ios-gray5);
    }

    /* 提示消息 iOS 风格 */
    .alert {
        border-radius: var(--ios-radius);
        border: none;
        margin: 0 16px 16px;
        padding: 14px 16px;
        font-size: 15px;
    }

    /* 设置页面 iOS 风格 */
    .settings-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .settings-nav {
        background: var(--ios-card-bg);
        border: none;
        border-radius: var(--ios-radius);
        padding: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .settings-nav-item {
        border-radius: 8px;
        padding: 12px 14px;
        font-size: 16px;
    }
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 0 16px;
    }
    .settings-tile {
        background: var(--ios-card-bg);
        border: none;
        border-radius: var(--ios-radius);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    /* 统计图表 iOS 风格 */
    .statistics-charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 16px;
    }
    .statistics-chart {
        height: 240px;
    }

    /* 键值列表 iOS 风格 */
    .kv-list {
        background: var(--ios-card-bg);
        border-radius: var(--ios-radius);
        padding: 0 16px;
        margin: 0 16px 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .kv-row {
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 10px 0;
        border-bottom: 0.5px solid var(--ios-separator);
    }
    .kv-row dt,
    .kv-row .kv-label {
        font-size: 14px;
        color: var(--ios-label-secondary);
    }
    .kv-row dd,
    .kv-row .kv-value {
        font-size: 16px;
    }

    /* 日历 iOS 风格 */
    .dashboard-calendar {
        background: var(--ios-card-bg);
        border-radius: var(--ios-radius-lg);
        padding: 12px;
        margin: 0 16px 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .dashboard-calendar .fc-toolbar-title {
        font-size: 18px;
        font-weight: 700;
    }
    .dashboard-calendar .fc-button {
        background: var(--ios-gray5);
        border: none;
        color: var(--ios-label);
        border-radius: 8px;
        font-weight: 500;
    }
    .dashboard-calendar .fc-button-primary:not(:disabled).fc-button-active {
        background: var(--ios-blue);
    }

    /* 登录页 iOS 风格 */
    .login-wrapper {
        background: var(--ios-bg);
        padding: 0;
    }
    .login-card {
        max-width: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        padding: 60px 24px 24px;
    }
    .login-brand {
        margin-bottom: 40px;
    }
    .login-brand img {
        width: 56px;
        height: 56px;
        border-radius: 14px;
    }
    .login-brand span {
        font-size: 24px;
        font-weight: 700;
    }
    .login-title {
        font-size: 28px;
        font-weight: 700;
        text-align: left;
        margin-bottom: 8px;
    }
    .login-subtitle {
        text-align: left;
        font-size: 17px;
        margin-bottom: 32px;
    }
    .login-card .form-control {
        height: 50px;
        font-size: 17px;
        border-radius: var(--ios-radius);
        background: var(--ios-card-bg);
    }
    .login-card .btn-primary {
        height: 50px;
        font-size: 17px;
        border-radius: var(--ios-radius);
        margin-top: 8px;
    }

    /* 滚动条隐藏 */
    ::-webkit-scrollbar {
        display: none;
    }

    /* 安全区域适配 */
    .ios-nav-bar {
        padding-top: max(env(safe-area-inset-top), 0px);
    }
    .ios-tab-bar {
        padding-bottom: max(env(safe-area-inset-bottom), 0px);
    }
}

/* 超小屏幕调整 */
@media (max-width: 375px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    .hero-summary-grid {
        grid-template-columns: 1fr;
    }
    .ios-large-title h1 {
        font-size: 28px;
    }
}

/* ──────────────────────────────────────────────────────────
   iOS 主题微调 - 修复文字显示不全
   ────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    /* 底部标签栏 - 确保文字完整显示 */
    .ios-tab-bar {
        height: auto;
        min-height: 83px;
        padding-bottom: max(env(safe-area-inset-bottom), 8px);
    }
    .ios-tab-item {
        height: auto;
        min-height: 49px;
        padding-top: 8px;
        padding-bottom: 4px;
    }
    .ios-tab-item span {
        font-size: 10px;
        font-weight: 500;
        line-height: 1.2;
        margin-top: 2px;
        white-space: nowrap;
    }
    .ios-tab-item svg {
        width: 24px;
        height: 24px;
        margin-bottom: 3px;
    }

    /* 顶部导航栏 - 确保标题不被截断 */
    .ios-nav-bar-title {
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 16px;
    }

    /* 表格卡片 - 确保文字换行完整 */
    .data-table tbody td {
        align-items: flex-start;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .data-table tbody td::before {
        max-width: 45%;
        word-break: normal;
    }
    .data-table tbody td > * {
        max-width: 55%;
        word-break: break-word;
        text-align: right;
    }
    .data-table tbody td.col-primary a {
        word-break: break-word;
    }

    /* 统计卡片 - 确保数字完整 */
    .summary-tile-value {
        word-break: break-all;
        line-height: 1.1;
    }

    /* 按钮文字 - 确保不被截断 */
    .btn {
        white-space: nowrap;
        overflow: visible;
    }
    .toolbar-actions .btn {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 表单标签 - 确保完整显示 */
    .form-label {
        white-space: normal;
        word-break: break-word;
    }

    /* 标签页 - 确保文字完整 */
    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 13px;
        padding: 7px 8px;
    }

    /* 徽章 - 确保文字完整 */
    .badge,
    .status-badge {
        white-space: nowrap;
    }

    /* 列表项 - 确保文字换行 */
    .ios-list-item-title,
    .ios-list-item-subtitle {
        word-break: break-word;
    }
    .ios-list-item-value {
        word-break: break-word;
        text-align: right;
    }

    /* Hero摘要 - 确保文字完整 */
    .hero-summary-field-label {
        white-space: normal;
        word-break: break-word;
    }
    .hero-summary-field-value {
        word-break: break-word;
    }

    /* 大标题 - 确保不被截断 */
    .ios-large-title h1 {
        word-break: break-word;
        line-height: 1.2;
    }

    /* 下拉菜单 - 确保文字完整 */
    .dropdown-item {
        white-space: normal;
        word-break: break-word;
    }

    /* 空状态 - 确保文字完整 */
    .empty-state-title,
    .empty-state-text {
        word-break: break-word;
    }
}
/* AI 助手悬浮按钮和对话窗口样式 */
.ai-float-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: all 0.3s ease;
}
.ai-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 122, 255, 0.5);
}
.ai-float-btn:active {
    transform: scale(0.95);
}
.ai-float-btn svg {
    width: 28px;
    height: 28px;
}
.ai-float-btn .ai-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #FF3B30;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* AI 对话窗口 */
.ai-chat-window {
    position: fixed;
    bottom: 170px;
    right: 20px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 200px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 10000;
    overflow: hidden;
    animation: aiSlideUp 0.3s ease;
}
.ai-chat-window.open {
    display: flex;
}
@keyframes aiSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-chat-header {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: #fff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.ai-chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-chat-header-title svg {
    width: 24px;
    height: 24px;
}
.ai-chat-header-title span {
    font-size: 16px;
    font-weight: 600;
}
.ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.ai-chat-close:hover { opacity: 1; }
.ai-chat-close svg { width: 20px; height: 20px; }

/* 快捷功能区 */
.ai-quick-actions {
    padding: 12px;
    background: #F2F2F7;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.ai-quick-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 8px;
    border: 1px solid #E5E5EA;
    background: #fff;
    border-radius: 10px;
    font-size: 13px;
    color: #007AFF;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.ai-quick-btn:hover {
    background: #007AFF;
    color: #fff;
    border-color: #007AFF;
}
.ai-quick-btn svg { width: 16px; height: 16px; }

/* 消息区 */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #F2F2F7;
}
.ai-msg {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
}
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.ai-msg.ai .ai-msg-avatar {
    background: linear-gradient(135deg, #007AFF, #5856D6);
    color: #fff;
}
.ai-msg.user .ai-msg-avatar {
    background: #34C759;
    color: #fff;
}
.ai-msg-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}
.ai-msg.ai .ai-msg-bubble {
    background: #fff;
    color: #000;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.ai-msg.user .ai-msg-bubble {
    background: #007AFF;
    color: #fff;
    border-top-right-radius: 4px;
}
.ai-msg.typing .ai-msg-bubble {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
}
.ai-msg.typing .dot {
    width: 8px;
    height: 8px;
    background: #8E8E93;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.ai-msg.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-msg.typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* 输入区 */
.ai-chat-input {
    padding: 12px;
    background: #fff;
    border-top: 1px solid #E5E5EA;
    display: flex;
    gap: 8px;
}
.ai-chat-input textarea {
    flex: 1;
    border: 1px solid #E5E5EA;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    height: 40px;
    max-height: 100px;
    outline: none;
    font-family: inherit;
}
.ai-chat-input textarea:focus {
    border-color: #007AFF;
}
.ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #007AFF;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ai-send-btn svg { width: 18px; height: 18px; }

/* 移动端适配 */
@media (max-width: 575.98px) {
    .ai-float-btn {
        bottom: 90px;
        right: 16px;
        width: 50px;
        height: 50px;
    }
    .ai-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 80vh;
        max-height: 80vh;
        border-radius: 16px 16px 0 0;
    }
}

/* === 移动端布局修复 v2 === */
@media (max-width: 768px) {
    /* 隐藏操作列 */
    body .data-table .col-actions,
    body .data-table th.col-actions,
    body .data-table td.col-actions {
        display: none !important;
    }
    
    /* 顶部按钮文字强制显示 */
    .page-head-actions .btn span,
    .toolbar-actions .btn span {
        display: inline !important;
        color: inherit !important;
        font-size: 14px !important;
    }
    
    .page-head-actions .btn,
    .toolbar-actions .btn {
        padding: 10px 20px !important;
        min-width: auto !important;
        height: auto !important;
    }
    
    /* 卡片式表格 */
    .data-table thead {
        display: none !important;
    }
    
    .data-table tbody tr {
        display: block !important;
        background: #fff !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
        padding: 16px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
        border: none !important;
    }
    
    .data-table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 0 !important;
        border: none !important;
        border-bottom: 1px solid #F2F2F7 !important;
        text-align: right !important;
    }
    
    .data-table tbody td:last-child {
        border-bottom: none !important;
    }
    
    .data-table tbody td::before {
        content: attr(data-label) !important;
        font-weight: 500 !important;
        color: #8E8E93 !important;
        font-size: 13px !important;
        text-align: left !important;
        flex-shrink: 0 !important;
        margin-right: 12px !important;
    }
    
    /* 空值占位符 */
    .data-table td {
        min-height: 24px;
    }
}

/* 强制更新标记 */
