/* ArchiSymphonyNo5 Styles
 * Base layout adapted from ArchiSymphonyCloud 00102-base-template
 * Fixed header + collapsible sidebar + main content + fixed footer
 */

/* Tabler CSS Framework (core table & component styles) */
@import url('https://cdn.jsdelivr.net/npm/@tabler/core@1.0.0-beta20/dist/css/tabler.min.css');

/* Error Boundary UI */
@import url('/css/error-boundary.css');

/* ========================================
   CSS Custom Properties (Design System)
   ======================================== */
:root {
    /* Brand palette (ArchiSymphonyCloud — MS 1100-11 Color System) */
    --as-navy: #1B3A4B;
    --as-teal: #3D8B93;
    --as-cyan-light: #4EBDC4;

    /* Primary palette */
    --as-primary: var(--as-teal);
    --as-primary-hover: #357A82;
    --as-primary-dark: var(--as-navy);
    --as-primary-light: var(--as-cyan-light);
    --as-gradient: linear-gradient(135deg, #3D8B93 0%, #1B3A4B 100%);

    /* Neutral */
    --as-white: #FFFFFF;
    --as-gray-light: #F8F9FA;
    --as-gray: #6B7280;
    --as-gray-dark: #374151;

    /* Background */
    --as-bg-primary: var(--as-white);
    --as-bg-secondary: var(--as-gray-light);
    --as-bg-accent: var(--as-cyan-light);
    --as-bg-dark: var(--as-navy);

    /* Text */
    --as-text-primary: var(--as-gray-dark);
    --as-text-secondary: var(--as-gray);
    --as-text-inverse: var(--as-white);
    --as-text-accent: var(--as-teal);

    /* Border / Shadow (MS 1100-11 tokens) */
    --as-border-light: #E9ECEF;
    --as-border-default: #DEE2E6;
    --as-shadow-sm: 0 1px 2px rgba(27, 58, 75, 0.05);
    --as-shadow-hover: 0 4px 12px rgba(61, 139, 147, 0.15);

    /* Semantic colors */
    --as-success: #10b981;
    --as-error: #ef4444;
    --as-warning: #f59e0b;
    --as-info: #3b82f6;

    /* Layout dimensions */
    --as-header-height: 48px;
    --as-sidebar-width: 240px;
    --as-sidebar-collapsed: 56px;
    --as-page-title-height: 110px;

    /* Header */
    --as-header-bg: #1B3A4B;
    --as-header-text: #ffffff;

    /* Sidebar */
    --as-sidebar-bg: #1B3A4B;
    --as-sidebar-text: #94a3b8;
    --as-sidebar-hover: rgba(61, 139, 147, 0.15);
    --as-sidebar-active: #3D8B93;

    /* Content */
    --as-content-bg: #f8fafc;
    --as-card-bg: #ffffff;
    --as-text: #1e293b;
    --as-text-muted: #64748b;

    /* Footer */
    --as-footer-bg: #1B3A4B;
    --as-footer-text: #94a3b8;

    /* Page Title Bar */
    --as-page-title-bg: linear-gradient(135deg, #3D8B93 0%, #1B3A4B 100%);

    /* Borders & Shadows */
    --as-border: #e2e8f0;
    --as-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --as-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --as-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Typography */
    --as-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --as-font-mono: 'SF Mono', Monaco, Consolas, monospace;
    --as-radius: 8px;
    --as-radius-sm: 4px;
    --as-radius-lg: 12px;

    /* Z-index layers */
    --as-z-dropdown: 100;
    --as-z-sticky: 200;
    --as-z-modal-backdrop: 300;
    --as-z-modal: 400;
    --as-z-toast: 500;
    --as-z-sidebar: 900;
    --as-z-header: 1000;

    /* Spacing scale (4px base) */
    --as-space-1: 0.25rem;
    --as-space-2: 0.5rem;
    --as-space-3: 0.75rem;
    --as-space-4: 1rem;
    --as-space-6: 1.5rem;
    --as-space-8: 2rem;

    /* Typography scale */
    --as-text-xs: 0.75rem;
    --as-text-sm: 0.8125rem;
    --as-text-base: 0.875rem;
    --as-text-md: 1rem;
    --as-text-lg: 1.125rem;
    --as-text-xl: 1.25rem;
    --as-text-2xl: 1.5rem;

    /* Font weights */
    --as-font-normal: 400;
    --as-font-medium: 500;
    --as-font-semibold: 600;
    --as-font-bold: 700;

    /* Transitions */
    --as-transition-fast: 150ms ease;
    --as-transition-base: 200ms ease;
    --as-transition-slow: 300ms ease;

    /* Focus ring */
    --as-focus-ring: 0 0 0 3px rgba(61, 139, 147, 0.2);

    /* Legacy variables (backwards compatibility) */
    --primary-color: var(--as-primary);
    --primary-hover: var(--as-primary-dark);
    --success-color: var(--as-success);
    --error-color: var(--as-error);
    --warning-color: var(--as-warning);
    --background-color: var(--as-content-bg);
    --surface-color: var(--as-card-bg);
    --text-primary: var(--as-text);
    --text-secondary: var(--as-text-muted);
    --text-inverse: var(--as-text-inverse);
    --border-color: var(--as-border);
    --shadow: var(--as-shadow);
    --shadow-md: var(--as-shadow-md);
    --font-family: var(--as-font);
    --font-mono: var(--as-font-mono);
    --radius: var(--as-radius);
}

/* ========================================
   Reset
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--as-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--as-text);
    background: var(--as-content-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Global Header (as-header)
   ======================================== */
.as-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--as-header-height);
    background: var(--as-header-bg);
    color: var(--as-header-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: var(--as-z-header);
    box-shadow: 0 2px 8px rgba(27, 58, 75, 0.3);
}

.as-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.as-header-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--as-header-text);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--as-radius-sm);
    font-size: 1.25rem;
    line-height: 1;
}

.as-header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
}

.as-header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}

.as-header-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: var(--as-header-text);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
    white-space: nowrap;
    font-size: 14px;
    opacity: 0.85;
}

.as-header-nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

.as-header-nav a.active {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.as-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.as-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--as-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
}

.as-user-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.as-user-role {
    font-size: 0.7rem;
    opacity: 0.8;
}

.as-header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--as-header-text);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    gap: 6px;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}

.as-header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: transparent;
}

/* ========================================
   Sidebar (as-sidebar)
   ======================================== */
.as-sidebar {
    position: fixed;
    top: var(--as-header-height);
    left: 0;
    bottom: 0;
    width: var(--as-sidebar-width);
    background: var(--as-sidebar-bg);
    overflow-y: auto;
    z-index: var(--as-z-sidebar);
    transition: transform 0.3s ease;
}

.as-sidebar-section {
    padding: 0.75rem 0 0.25rem;
}

.as-sidebar-title {
    padding: 0.25rem 1.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--as-sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.6;
}

.as-sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.as-sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: var(--as-sidebar-text);
    text-decoration: none;
    transition: background-color var(--as-transition-fast), color var(--as-transition-fast), border-color var(--as-transition-fast);
    border-left: 3px solid transparent;
    font-size: 0.85rem;
}

.as-sidebar-nav li a:hover {
    background: var(--as-sidebar-hover);
    color: #fff;
}

.as-sidebar-nav li.active a,
.as-sidebar-nav li a.active {
    background: var(--as-sidebar-hover);
    color: var(--as-sidebar-active);
    border-left-color: var(--as-sidebar-active);
}

.as-sidebar-nav li a .as-nav-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.as-sidebar-nav li a .as-nav-icon i {
    font-size: 1.1rem;
    line-height: 1;
}

.as-sidebar-nav li a .as-badge {
    margin-left: auto;
}

/* ========================================
   Sidebar Accordion
   ======================================== */
.as-sidebar-title {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: opacity 0.2s;
}
.as-sidebar-title:hover { opacity: 0.85; }

/* Chevron indicator (CSS ::after, no icon library needed) */
.as-sidebar-title::after {
    content: '';
    display: inline-block;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.as-sidebar-section.as-expanded .as-sidebar-title::after {
    transform: rotate(180deg);
}

/* Collapsible nav list */
.as-sidebar-section .as-sidebar-nav {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
    padding: 0;
}
.as-sidebar-section.as-expanded .as-sidebar-nav {
    max-height: 1000px;
    opacity: 1;
    padding: 0.25rem 0;
}

/* GENERAL section: always expanded, no chevron */
.as-sidebar-section[data-section="sidebar.general"] .as-sidebar-nav,
.as-sidebar-section[data-section="general"] .as-sidebar-nav {
    max-height: 1000px;
    opacity: 1;
    padding: 0.25rem 0;
}
.as-sidebar-section[data-section="sidebar.general"] .as-sidebar-title::after,
.as-sidebar-section[data-section="general"] .as-sidebar-title::after {
    display: none;
}

/* Keyboard focus */
.as-sidebar-title:focus-visible {
    outline: 2px solid var(--as-sidebar-active);
    outline-offset: -2px;
}

/* ========================================
   Main Content (as-main)
   ======================================== */
.as-main {
    margin-top: calc(var(--as-header-height) + var(--as-page-title-height));
    margin-left: var(--as-sidebar-width);
    margin-bottom: 0;
    min-height: calc(100vh - var(--as-header-height) - var(--as-page-title-height));
}

.as-content {
    padding: 1.5rem;
}

/* Page header */
.as-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.as-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--as-text);
    margin: 0;
}

.as-page-subtitle {
    font-size: 0.85rem;
    color: var(--as-text-muted);
    margin-top: 0.25rem;
}

.as-page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Breadcrumb (inside title bar) */
.as-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.25rem;
}

.as-breadcrumb a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.as-breadcrumb a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.as-breadcrumb-sep::before {
    content: '/';
    margin: 0 0.25rem;
}

/* ========================================
   Footer (as-footer)
   ======================================== */
.as-footer {
    position: relative;
    margin-left: var(--as-sidebar-width);
    background: var(--as-footer-bg);
    color: var(--as-footer-text);
    font-size: 0.75rem;
    padding: 24px 0 16px;
    transition: margin-left 0.3s ease;
}

.as-footer p {
    margin: 0;
}

.as-footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.as-footer-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.as-footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.as-footer-section ul li {
    margin-bottom: 0.4rem;
}

.as-footer-section ul li a {
    color: var(--as-footer-text);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.as-footer-section ul li a:hover {
    color: #ffffff;
}

.as-footer-bottom {
    border-top: 1px solid var(--as-teal);
    text-align: center;
    padding: 16px 24px 0;
    margin-top: 16px;
}

/* ========================================
   Page Title Bar (as-page-title-bar)
   ======================================== */
.as-page-title-bar {
    position: fixed;
    top: var(--as-header-height);
    left: var(--as-sidebar-width);
    right: 0;
    min-height: var(--as-page-title-height);
    background: var(--as-page-title-bg);
    color: #ffffff;
    padding: 16px 24px;
    z-index: var(--as-z-sticky);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: left 0.3s ease;
}

.as-page-title-bar .as-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.as-page-title-bar .as-page-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 0.15rem;
}

/* Header brand badge */
.as-header-badge {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 0.25rem;
    font-weight: 400;
}

/* ========================================
   Cards (as-card)
   ======================================== */
.as-card {
    background: var(--as-card-bg);
    border-radius: var(--as-radius);
    box-shadow: var(--as-shadow);
    border: 1px solid var(--as-border);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: box-shadow var(--as-transition-base);
}

.as-card:hover {
    box-shadow: var(--as-shadow-md);
}

.as-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--as-border);
}

.as-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

/* ========================================
   Buttons (as-btn)
   ======================================== */
.as-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--as-font);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.as-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.as-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.as-btn-primary {
    background: var(--as-primary);
    color: var(--as-text-inverse);
    border-color: var(--as-primary);
}

.as-btn-primary:hover:not(:disabled) {
    background: var(--as-primary-hover);
    border-color: var(--as-primary-hover);
}

.as-btn-secondary {
    background: var(--as-card-bg);
    color: var(--as-text);
    border-color: var(--as-border);
}

.as-btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.as-btn-danger {
    background: var(--as-error);
    color: var(--as-text-inverse);
    border-color: var(--as-error);
}

.as-btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

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

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

.as-btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.as-btn-icon {
    padding: 0.4rem;
    min-width: 32px;
}

.as-btn-md {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
}

.as-btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.as-btn-outline-primary {
    background: transparent;
    color: var(--as-primary);
    border-color: var(--as-primary);
}

.as-btn-outline-primary:hover:not(:disabled) {
    background: var(--as-primary);
    color: var(--as-text-inverse);
}

.as-btn-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.as-btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: as-spin 0.6s linear infinite;
    left: 50%;
    top: 50%;
    margin-left: -8px;
    margin-top: -8px;
    color: var(--as-text-inverse);
}

/* ========================================
   Data Tables (Tabler-enhanced as-table)
   ======================================== */
.as-table-container {
    overflow-x: auto;
    border: 1px solid var(--as-border-default);
    border-radius: 8px;
    background: var(--as-white);
    box-shadow: var(--as-shadow-sm);
}

.as-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
}

.as-table thead {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.as-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0.02em;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    z-index: 1;
    cursor: default;
    user-select: none;
}

.as-table th.sortable {
    cursor: pointer;
    transition: color 0.15s ease;
}

.as-table th.sortable:hover {
    color: var(--as-primary);
    background: linear-gradient(180deg, #f1f5f9 0%, #e8ecf1 100%);
}

.as-table th .sort-indicator {
    margin-left: 0.35rem;
    opacity: 0.35;
    font-size: 0.65rem;
    transition: opacity 0.15s ease;
}

.as-table th.sortable:hover .sort-indicator { opacity: 0.7; }
.as-table th .sort-indicator.asc { opacity: 1; color: var(--as-primary); }
.as-table th .sort-indicator.desc { opacity: 1; color: var(--as-primary); }
.as-table th .sort-indicator.asc::after { content: '\f35f'; font-family: 'tabler-icons'; font-size: 0.8rem; }
.as-table th .sort-indicator.desc::after { content: '\f354'; font-family: 'tabler-icons'; font-size: 0.8rem; }
.as-table th .sort-indicator.none::after { content: '\eb4a'; font-family: 'tabler-icons'; font-size: 0.8rem; }

.as-table td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--as-text-primary);
    vertical-align: middle;
}

.as-table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.as-table tbody tr:hover {
    background: #f8fafc;
}

.as-table tbody tr:last-child td {
    border-bottom: none;
}

.as-table .actions-cell {
    white-space: nowrap;
    text-align: right;
    width: 1%;
}

.as-table .actions-cell .as-btn + .as-btn {
    margin-left: 0.25rem;
}

/* Numeric / amount columns — right-align */
.as-table td.text-end,
.as-table th.text-end {
    text-align: right;
}

/* Table variants */
.as-table-striped tbody tr:nth-child(even) {
    background: #fafbfc;
}

.as-table-striped tbody tr:nth-child(even):hover {
    background: #f1f5f9;
}

.as-table-clickable tbody tr {
    cursor: pointer;
}

.as-table-clickable tbody tr:hover {
    background: #eef4fb;
    box-shadow: inset 3px 0 0 var(--as-primary);
}

.as-table-clickable tbody tr:active {
    background: #e2e8f0;
}

.as-table-clickable tbody tr.as-row-selected {
    background: #eef4fb;
    box-shadow: inset 3px 0 0 var(--as-primary);
}

.as-table-compact th,
.as-table-compact td {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

/* ========================================
   Table Detail Slide Panel
   ======================================== */
.as-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.3);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.as-detail-overlay.as-open {
    opacity: 1;
    visibility: visible;
}

.as-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(480px, 90vw);
    height: 100vh;
    background: var(--as-white);
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12);
    z-index: 1051;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.as-detail-panel.as-open {
    transform: translateX(0);
}

.as-detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--as-border-default);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    flex-shrink: 0;
}

.as-detail-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--as-text-primary);
}

.as-detail-panel-close {
    background: none;
    border: 1px solid var(--as-border-default);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 1.1rem;
    transition: all 0.15s ease;
}

.as-detail-panel-close:hover {
    background: #f1f5f9;
    color: var(--as-text-primary);
}

.as-detail-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.as-detail-panel-body dl {
    display: grid;
    grid-template-columns: minmax(100px, 140px) 1fr;
    gap: 0;
    margin: 0;
}

.as-detail-panel-body dt {
    padding: 0.625rem 0.75rem 0.625rem 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.as-detail-panel-body dd {
    padding: 0.625rem 0;
    margin: 0;
    font-size: 0.875rem;
    color: var(--as-text-primary);
    border-bottom: 1px solid #f1f5f9;
    word-break: break-word;
}

.as-detail-panel-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--as-border-default);
    background: #fafbfc;
    flex-shrink: 0;
}

/* ========================================
   Enhanced Badges (Tabler-style)
   ======================================== */
.as-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.as-badge-success { background: #ecfdf5; color: #059669; }
.as-badge-warning { background: #fffbeb; color: #d97706; }
.as-badge-danger  { background: #fef2f2; color: #dc2626; }
.as-badge-info    { background: #eff6ff; color: #2563eb; }
.as-badge-secondary { background: #f1f5f9; color: #475569; }
.as-badge-primary { background: #eef4fb; color: var(--as-primary); }

/* Badge with dot indicator */
.as-badge-dot::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.35rem;
    background: currentColor;
}

/* ========================================
   Progress Bar (for goal/budget tracking)
   ======================================== */
.as-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.as-progress-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.as-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    background: var(--as-primary);
}

.as-progress-fill.as-progress-success { background: #10b981; }
.as-progress-fill.as-progress-warning { background: #f59e0b; }
.as-progress-fill.as-progress-danger  { background: #ef4444; }

.as-progress-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    min-width: 36px;
    text-align: right;
}

/* Empty state */
.as-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--as-text-secondary);
}

.as-empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.as-empty-state-text {
    font-size: 0.9rem;
}

/* ========================================
   Toolbar / Filter Bar (as-toolbar)
   ======================================== */
.as-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.as-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.as-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.as-search-input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--as-border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--as-font);
    outline: none;
    min-width: 200px;
    transition: border-color 0.2s;
}

.as-search-input:focus {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(61, 139, 147, 0.15);
}

/* ========================================
   Pagination (as-pagination)
   ======================================== */
.as-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    font-size: 0.8rem;
    color: var(--as-text-muted);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.as-pagination-info {
    white-space: nowrap;
}

.as-pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.as-pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-sm);
    background: var(--as-card-bg);
    color: var(--as-text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.as-pagination-btn:hover:not(:disabled) {
    border-color: var(--as-primary);
    color: var(--as-primary);
}

.as-pagination-btn.active {
    background: var(--as-primary);
    color: var(--as-text-inverse);
    border-color: var(--as-primary);
}

.as-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========================================
   Forms (as-form)
   ======================================== */
.as-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.as-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.as-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.as-form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--as-text);
}

.as-form-label .required {
    color: var(--as-error);
    margin-left: 0.125rem;
}

.as-form-input,
.as-form-select,
.as-form-textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--as-border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: var(--as-font);
    transition: border-color 0.2s;
    outline: none;
    color: var(--as-text);
    background: var(--as-card-bg);
}

.as-form-input:focus,
.as-form-select:focus,
.as-form-textarea:focus {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(61, 139, 147, 0.15);
}

.as-form-input:hover:not(:focus):not(:disabled),
.as-form-select:hover:not(:focus):not(:disabled),
.as-form-textarea:hover:not(:focus):not(:disabled) {
    border-color: #94a3b8;
}

.as-form-input:disabled,
.as-form-select:disabled,
.as-form-textarea:disabled {
    background: #f1f5f9;
    color: var(--as-text-muted);
    cursor: not-allowed;
}

.as-form-input.error,
.as-form-select.error {
    border-color: var(--as-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.as-form-input.success,
.as-form-select.success {
    border-color: var(--as-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.as-form-input.warning,
.as-form-select.warning {
    border-color: var(--as-warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.as-form-error {
    font-size: 0.75rem;
    color: var(--as-error);
}

.as-form-success {
    font-size: 0.75rem;
    color: var(--as-success);
}

.as-form-hint {
    font-size: 0.75rem;
    color: var(--as-text-muted);
}

.as-form-counter {
    font-size: 0.7rem;
    color: var(--as-text-muted);
    text-align: right;
    margin-top: 0.15rem;
}

.as-form-counter.over-limit {
    color: var(--as-error);
    font-weight: 600;
}

.as-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.as-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

/* ========================================
   Modal (as-modal)
   ======================================== */
.as-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--as-z-modal-backdrop);
    align-items: center;
    justify-content: center;
}

.as-modal-backdrop.active {
    display: flex;
}

.as-modal {
    background: var(--as-card-bg);
    border-radius: var(--as-radius-lg);
    box-shadow: var(--as-shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: as-modal-in 0.2s ease;
}

@keyframes as-modal-in {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.as-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--as-border);
}

.as-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.as-modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--as-text-muted);
    padding: 0.25rem;
    border-radius: var(--as-radius-sm);
    line-height: 1;
}

.as-modal-close:hover {
    background: #f1f5f9;
    color: var(--as-text);
}

.as-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.as-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--as-border);
}

/* ========================================
   Delete Confirmation (as-confirm)
   ======================================== */
.as-confirm-message {
    text-align: center;
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--as-text);
}

.as-confirm-name {
    font-weight: 600;
    color: var(--as-error);
}

/* ========================================
   Tile Grid (as-tile) - Category browsing
   ======================================== */
.as-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.as-tile {
    background: var(--as-card-bg);
    border-radius: var(--as-radius);
    border: 1px solid var(--as-border);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.as-tile:hover {
    box-shadow: var(--as-shadow-md);
    transform: translateY(-2px);
}

.as-tile-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--as-text-muted);
    font-size: 2rem;
}

.as-tile-body {
    padding: 0.75rem 1rem;
}

.as-tile-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--as-text);
}

.as-tile-meta {
    font-size: 0.75rem;
    color: var(--as-text-muted);
}

/* ========================================
   Alerts & Toasts (as-alert)
   ======================================== */
.as-alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.as-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.as-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.as-alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.as-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Toast container */
.as-toast-container {
    position: fixed;
    top: calc(var(--as-header-height) + 1rem);
    right: 1rem;
    z-index: var(--as-z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.as-toast {
    background: var(--as-card-bg);
    border-radius: var(--as-radius);
    box-shadow: var(--as-shadow-lg);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    max-width: 360px;
    pointer-events: auto;
    animation: as-toast-in 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.as-toast.as-toast-out {
    animation: as-toast-out 0.3s ease forwards;
}

@keyframes as-toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes as-toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ========================================
   Badge (as-badge)
   ======================================== */
.as-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9px;
    background: var(--as-error);
    color: #fff;
}

.as-badge-success { background: var(--as-success); }
.as-badge-warning { background: var(--as-warning); color: #000; }
.as-badge-info { background: var(--as-info); }

.as-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
}

.as-status-active {
    background: #dcfce7;
    color: #166534;
}

.as-status-inactive {
    background: #f1f5f9;
    color: #64748b;
}

/* ========================================
   Loading Spinner (as-loading)
   ======================================== */
.as-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.as-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--as-border);
    border-top-color: var(--as-primary);
    border-radius: 50%;
    animation: as-spin 0.6s linear infinite;
}

@keyframes as-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Dashboard Grid
   ======================================== */
.as-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.as-stat-card {
    background: var(--as-card-bg);
    border-radius: var(--as-radius);
    border: 1px solid var(--as-border);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform var(--as-transition-base), box-shadow var(--as-transition-base);
}

.as-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--as-shadow-md);
}

.as-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--as-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.as-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--as-text);
    line-height: 1.2;
}

.as-stat-label {
    font-size: 0.8rem;
    color: var(--as-text-muted);
}

/* ========================================
   Skeleton Loading (as-skeleton)
   ======================================== */
.as-skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: as-shimmer 1.5s infinite;
    border-radius: var(--as-radius-sm);
}

.as-skeleton-text {
    height: 0.875rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.as-skeleton-text:last-child {
    width: 60%;
}

.as-skeleton-circle {
    border-radius: 50%;
}

@keyframes as-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Utilities
   ======================================== */
.as-text-primary { color: var(--as-primary); }
.as-text-muted { color: var(--as-text-muted); }
.as-text-success { color: var(--as-success); }
.as-text-error { color: var(--as-error); }
.as-text-center { text-align: center; }
.as-text-right { text-align: right; }

.as-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.as-hidden { display: none; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 991px) {
    .as-sidebar {
        transform: translateX(-100%);
    }

    .as-sidebar.show {
        transform: translateX(0);
    }

    .as-main {
        margin-left: 0;
    }

    .as-page-title-bar {
        left: 0;
    }

    .as-footer {
        margin-left: 0;
    }

    .as-header-toggle {
        display: block;
    }

    .as-header-nav {
        display: none;
    }
}

/* Tablet adjustments (768-991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .as-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .as-tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 767px) {
    .as-header {
        padding: 0 0.75rem;
    }

    .as-content {
        padding: 1rem;
    }

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

    .as-tile-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

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

    .as-modal {
        width: 95%;
    }

    /* Touch target minimum 44px */
    .as-btn {
        min-height: 44px;
    }

    .as-btn-sm {
        min-height: 36px;
    }

    .as-sidebar-nav li a {
        min-height: 44px;
    }

    .as-pagination-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ========================================
   Legacy styles (backwards compatibility)
   Keep for login.html, index.html, etc.
   ======================================== */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.nav {
    background: var(--as-card-bg);
    border-bottom: 1px solid var(--as-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    box-shadow: var(--as-shadow);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--as-primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links a {
    color: var(--as-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--as-primary);
}

.nav-button {
    background: none;
    border: 1px solid var(--as-border);
    color: var(--as-text-muted);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.nav-button:hover {
    border-color: var(--as-error);
    color: var(--as-error);
}

.header {
    background: var(--as-gradient);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.status-bar {
    font-family: var(--as-font-mono);
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
    display: grid;
    gap: 1.5rem;
}

.card {
    background: var(--as-card-bg);
    border-radius: var(--as-radius);
    padding: 1.5rem;
    box-shadow: var(--as-shadow);
    border: 1px solid var(--as-border);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.card ul { list-style: none; padding: 0; }
.card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--as-border);
}
.card li:last-child { border-bottom: none; }

code {
    font-family: var(--as-font-mono);
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.login-card { max-width: 400px; margin: 0 auto; width: 100%; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--as-text);
}

.form-input {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--as-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--as-font);
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(61, 139, 147, 0.15);
}

.form-button {
    background: var(--as-primary);
    color: var(--as-text-inverse);
    border: none;
    padding: 0.7rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.form-button:hover { background: var(--as-primary-dark); }

.alert { padding: 0.75rem 1rem; border-radius: 6px; font-size: 0.9rem; margin-bottom: 0.5rem; }
.alert-error { background: #fef2f2; color: var(--as-error); border: 1px solid #fecaca; }

.lang-switcher {
    background: none;
    border: 1px solid var(--as-border);
    color: var(--as-text-muted);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.lang-switcher:hover { border-color: var(--as-primary); color: var(--as-primary); }

.user-info { font-size: 0.85rem; color: var(--as-text-muted); font-weight: 500; }
.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.health-grid p { padding: 0.25rem 0; }

.footer {
    background: var(--as-card-bg);
    border-top: 1px solid var(--as-border);
    padding: 1rem;
    text-align: center;
    color: var(--as-text-muted);
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .header h1 { font-size: 1.5rem; }
    .main { padding: 1rem 0.5rem; }
    .nav { padding: 0 0.75rem; }
    .nav-links { gap: 0.5rem; }
    .nav-links a { font-size: 0.8rem; }
    .health-grid { grid-template-columns: 1fr; }
}

/* ========================================
   Approval Stepper (MS 1100-60)
   ======================================== */
.as-stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 1.5rem 0;
    overflow-x: auto;
}

.as-stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 120px;
}

.as-stepper-step-header {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.as-stepper-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
    z-index: 1;
    background: var(--as-border);
    color: var(--as-text-muted);
    transition: all 0.3s;
}

.as-stepper-connector {
    flex: 1;
    height: 3px;
    background: var(--as-border);
    transition: background 0.3s;
}

.as-stepper-step--completed .as-stepper-circle {
    background: var(--as-success);
    color: #fff;
}

.as-stepper-step--completed .as-stepper-connector {
    background: var(--as-success);
}

.as-stepper-step--current .as-stepper-circle {
    background: var(--as-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(61, 139, 147, 0.25);
    animation: as-stepper-pulse 2s infinite;
}

.as-stepper-step--pending .as-stepper-circle {
    background: var(--as-border);
    color: var(--as-text-muted);
}

.as-stepper-step--skipped .as-stepper-circle {
    background: var(--as-border);
    color: var(--as-text-muted);
    text-decoration: line-through;
}

.as-stepper-step--auto .as-stepper-circle {
    background: var(--as-warning);
    color: #fff;
}

.as-stepper-label {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--as-text-muted);
    text-align: center;
    max-width: 100px;
    word-wrap: break-word;
}

.as-stepper-step--current .as-stepper-label {
    color: var(--as-primary);
    font-weight: 600;
}

.as-stepper-step--completed .as-stepper-label {
    color: var(--as-success);
}

.as-stepper-detail {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--as-content-bg);
    border-radius: 8px;
    font-size: 0.8rem;
    width: 100%;
    max-width: 200px;
}

.as-stepper-detail-approver {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
    color: var(--as-text);
}

.as-stepper-detail-comment {
    color: var(--as-text-muted);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.25rem;
}

@keyframes as-stepper-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(61, 139, 147, 0.25); }
    50% { box-shadow: 0 0 0 8px rgba(61, 139, 147, 0.15); }
}

/* Stepper vertical layout for mobile */
@media (max-width: 768px) {
    .as-stepper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 1rem 0;
    }

    .as-stepper-step {
        flex-direction: row;
        align-items: flex-start;
        min-width: auto;
        width: 100%;
    }

    .as-stepper-step-header {
        flex-direction: column;
        align-items: center;
        width: auto;
    }

    .as-stepper-connector {
        width: 3px;
        height: 32px;
        flex: none;
    }

    .as-stepper-label {
        margin-top: 0;
        margin-left: 0.75rem;
        text-align: left;
        max-width: none;
    }

    .as-stepper-detail {
        margin-top: 0;
        margin-left: 0.75rem;
        max-width: none;
    }
}

/* Tabler Icon integration */
.as-header-btn i,
.as-header-nav a i {
    font-size: 1.1rem;
    vertical-align: -0.125em;
}

/* ========================================
   Profile Dropdown (as-header-profile)
   ======================================== */
.as-header-profile {
    position: relative;
}

.as-profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--as-header-text);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.as-profile-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.as-profile-chevron {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    display: inline-block;
}

.as-header-profile.as-open .as-profile-chevron {
    transform: rotate(180deg);
}

.as-profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 240px;
    background: var(--as-card-bg);
    border-radius: var(--as-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--as-border);
    z-index: var(--as-z-dropdown);
    animation: as-dropdown-in 0.15s ease;
}

.as-profile-dropdown.as-open {
    display: block;
}

@keyframes as-dropdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.as-profile-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 16px;
    border-bottom: 1px solid var(--as-border);
}

.as-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--as-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.as-profile-header .as-profile-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--as-text);
    line-height: 1.3;
}

.as-profile-header .as-profile-role {
    font-size: 0.75rem;
    color: var(--as-text-muted);
}

.as-profile-divider {
    border: none;
    border-top: 1px solid var(--as-border);
    margin: 0;
}

/* Hide divider right after header (header already has border-bottom) */
.as-profile-header + .as-profile-divider {
    display: none;
}

.as-profile-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--as-text);
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: var(--as-font);
}

.as-profile-item:hover {
    background: #f3f4f6;
}

.as-profile-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    color: var(--as-text-muted);
}

.as-profile-logout {
    color: var(--as-error);
}

.as-profile-logout:hover {
    background: #fef2f2;
}

.as-profile-logout i {
    color: var(--as-error);
}

/* ========================================
   Notification Bell (as-header-notification)
   ======================================== */
.as-header-notification {
    position: relative;
    background: none;
    border: none;
    color: var(--as-header-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.as-header-notification:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Lang switcher arrow (Shell-style) */
.as-lang-arrow {
    font-size: 10px;
    opacity: 0.7;
}

/* ========================================
   D-ID Character Switcher (as-did-switcher)
   ======================================== */
.as-did-switcher {
    position: fixed;
    top: calc(var(--as-header-height) + 8px);
    right: 20px;
    display: flex;
    gap: 6px;
    z-index: calc(var(--as-z-header) - 1);
    background: rgba(27, 58, 75, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 4px;
    box-shadow: var(--as-shadow-md);
}

.as-did-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border: 1px solid rgba(61, 139, 147, 0.4);
    border-radius: 16px;
    background: var(--as-navy);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-family: var(--as-font);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.as-did-switcher-btn:hover {
    background: rgba(61, 139, 147, 0.3);
    color: #fff;
}

.as-did-switcher-btn.as-active {
    background: var(--as-teal);
    color: #fff;
    border-color: var(--as-teal);
}

.as-did-switcher-sep {
    width: 1px;
    background: rgba(61, 139, 147, 0.4);
    margin: 2px 0;
    align-self: stretch;
}

.as-did-toggle-btn {
    font-size: 0.72rem;
    opacity: 0.8;
}

.as-did-toggle-btn:hover {
    opacity: 1;
}

.as-did-toggle-btn.as-did-hidden {
    border-style: dashed;
    opacity: 0.6;
}

/* Responsive adjustments for new header elements */
@media (max-width: 991px) {
    .as-did-switcher {
        right: 12px;
        font-size: 0.72rem;
    }

    .as-did-switcher-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 767px) {
    .as-did-switcher {
        display: none;
    }

    .as-header-right .as-user-name,
    .as-header-right .as-user-role {
        display: none;
    }
}

/* ========================================
   Ltype Layout Patterns (MS 1100-11)
   ======================================== */

/* Ltype-B: Left sidebar 2-column — default layout (as-sidebar + as-main baseline, no class needed) */

/* Ltype-E: Grid card layout (dashboard) */
.as-layout-grid .as-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--as-space-6);
    align-content: start;
}

/* Ltype-F: Fixed header + scroll chat
   Uses JS to measure actual title bar height — see rag-chat.js adjustChatHeight() */
body.as-layout-chat {
    overflow: hidden;
}

.as-layout-chat .as-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.as-layout-chat .as-footer {
    display: none;
}

.as-layout-chat .as-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0;
    overflow: hidden;
}

/* Ltype-I: Centered form (login) */
.as-layout-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--as-bg-secondary);
}

.as-layout-center .as-main {
    margin: 0;
    width: 100%;
    max-width: 480px;
    min-height: auto;
}

/* Ltype-K: Step wizard */
.as-layout-wizard .as-content {
    display: flex;
    flex-direction: column;
    gap: var(--as-space-6);
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* DEPRECATED (Rule #11): Do not use as-layout-master-detail on <body>.
   Use page-specific CSS grid inside as-content instead.
   See: attendance.html, vdi-reservation.css for reference patterns. */
.as-layout-master-detail .as-content {
    display: grid;
    grid-template-columns: 30fr 70fr;
    gap: 0;
    padding: 0;
    height: calc(100vh - var(--as-header-height) - var(--as-page-title-height));
    overflow: hidden;
}

/* Ltype-G: Tab navigation */
.as-layout-tabs .as-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Responsive: Ltype overrides for mobile */
@media (max-width: 991px) {
    .as-layout-grid .as-content {
        grid-template-columns: 1fr;
    }

    .as-layout-master-detail .as-content {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
}

/* ========================================
   Ltype-C Components (Video Player / Theater)
   ======================================== */

/* Theater dark theme override */
.as-vp-theater .as-main {
    background: var(--as-navy);
}

.as-vp-theater .as-content {
    background: transparent;
    padding: var(--as-space-4);
}

/* 70/30 grid layout */
.as-vp-layout {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: var(--as-space-4);
    min-height: 0;
}

/* --- Player area --- */
.as-vp-player {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.as-vp-player video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Center overlay button (play/pause) */
.as-vp-center-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(27, 58, 75, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--as-white);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.as-vp-center-btn:hover {
    background: rgba(61, 139, 147, 0.8);
    transform: translate(-50%, -50%) scale(1.08);
}

.as-vp-center-btn.as-vp-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Buffering loader */
.as-vp-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 12;
    display: none;
}
.as-vp-loader.as-vp-visible { display: flex; }
.as-vp-loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--as-cyan-light, #5eead4);
    border-radius: 50%;
    animation: as-spin 0.8s linear infinite;
}

/* Skip buttons (10s forward/back) */
.as-vp-skip-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(27, 58, 75, 0.5);
    border: none;
    color: var(--as-white);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s, background 0.2s;
    z-index: 10;
    opacity: 0;
    backdrop-filter: blur(4px);
}

.as-vp-player:hover .as-vp-skip-btn {
    opacity: 1;
}

.as-vp-skip-btn:hover {
    background: rgba(61, 139, 147, 0.7);
}

.as-vp-skip-back { left: var(--as-space-4); }
.as-vp-skip-fwd  { right: var(--as-space-4); }

/* --- Bottom controls bar --- */
.as-vp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--as-space-2) var(--as-space-3);
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    display: flex;
    flex-direction: column;
    gap: var(--as-space-1);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 15;
}

.as-vp-player:hover .as-vp-controls {
    opacity: 1;
}

/* Seekbar container */
.as-vp-seekbar {
    position: relative;
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.as-vp-seekbar-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    overflow: visible;
}

.as-vp-seekbar-fill {
    height: 100%;
    background: var(--as-cyan-light);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.as-vp-seekbar-thumb {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--as-cyan-light);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.2s;
}

.as-vp-seekbar:hover .as-vp-seekbar-thumb {
    opacity: 1;
}

.as-vp-seekbar:hover .as-vp-seekbar-track {
    height: 6px;
}

/* Chapter markers on seekbar */
.as-vp-marker {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 12px;
    background: rgba(255,255,255,0.6);
    border-radius: 1px;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: auto;
}

.as-vp-marker:hover {
    background: var(--as-cyan-light);
    height: 16px;
}

/* Seekbar tooltip */
.as-vp-tooltip {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(27, 58, 75, 0.95);
    color: var(--as-white);
    padding: var(--as-space-1) var(--as-space-2);
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 20;
}

.as-vp-marker:hover .as-vp-tooltip,
.as-vp-seekbar:hover .as-vp-tooltip.as-vp-visible {
    opacity: 1;
}

/* Controls row (buttons + volume + time + fullscreen) */
.as-vp-controls-row {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
}

.as-vp-ctrl-btn {
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: none;
    color: var(--as-white);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.as-vp-ctrl-btn:hover {
    background: rgba(255,255,255,0.15);
}

.as-vp-time {
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    user-select: none;
}

.as-vp-spacer { flex: 1; }

/* Volume slider */
.as-vp-volume-wrap {
    display: flex;
    align-items: center;
    gap: var(--as-space-1);
}

.as-vp-volume-slider {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.as-vp-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--as-white);
    cursor: pointer;
}

/* --- Video info below player --- */
.as-vp-info {
    padding: var(--as-space-3) 0;
}

.as-vp-info-title {
    margin: 0 0 var(--as-space-1) 0;
    font-size: 1.15rem;
    color: var(--as-white);
    font-weight: 600;
}

.as-vp-info-desc {
    margin: 0;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
}

/* Progress bar below video */
.as-vp-progress {
    margin-top: var(--as-space-2);
}

.as-vp-progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

.as-vp-progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
}

.as-vp-progress-fill {
    height: 100%;
    background: var(--as-success);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* --- Right sidebar --- */
.as-vp-sidebar {
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--as-header-height) - var(--as-page-title-height) - var(--as-space-4) * 2);
    overflow: hidden;
}

/* Tab navigation (Ltype-G inside sidebar) */
.as-vp-tabs-nav {
    display: flex;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.as-vp-tab-btn {
    flex: 1;
    min-height: 44px;
    padding: var(--as-space-2) var(--as-space-2);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    text-align: center;
    white-space: nowrap;
}

.as-vp-tab-btn:hover {
    color: rgba(255,255,255,0.8);
}

.as-vp-tab-btn.active {
    color: var(--as-cyan-light);
    border-bottom-color: var(--as-cyan-light);
}

.as-vp-tab-panel {
    flex: 1;
    overflow-y: auto;
    padding: var(--as-space-2);
}

.as-vp-tab-pane {
    display: none;
}

.as-vp-tab-pane.active {
    display: block;
}

/* Chapter list items */
.as-vp-chapter-item {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    padding: var(--as-space-2);
    min-height: 44px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.as-vp-chapter-item:hover {
    background: rgba(255,255,255,0.08);
}

.as-vp-chapter-item.active {
    background: rgba(61, 139, 147, 0.2);
    border-left: 3px solid var(--as-cyan-light);
}

.as-vp-chapter-thumb {
    width: 64px;
    height: 36px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    overflow: hidden;
}

.as-vp-chapter-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.as-vp-chapter-body {
    flex: 1;
    min-width: 0;
}

.as-vp-chapter-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-vp-chapter-time {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    font-variant-numeric: tabular-nums;
}

/* AI analysis items */
.as-vp-analysis-item {
    display: flex;
    gap: var(--as-space-2);
    padding: var(--as-space-2);
    min-height: 44px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    align-items: flex-start;
}

.as-vp-analysis-item:hover {
    background: rgba(255,255,255,0.08);
}

.as-vp-analysis-time {
    font-size: 0.75rem;
    color: var(--as-cyan-light);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    padding-top: 2px;
    flex-shrink: 0;
}

.as-vp-analysis-body {
    flex: 1;
    min-width: 0;
}

.as-vp-analysis-text {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    line-height: 1.4;
}

.as-vp-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 4px;
}

.as-vp-badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--as-error);
}

.as-vp-badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--as-warning);
}

.as-vp-badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--as-success);
}

.as-vp-badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--as-info);
}

/* Related documents */
.as-vp-doc-item {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    padding: var(--as-space-2);
    min-height: 44px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.as-vp-doc-item:hover {
    background: rgba(255,255,255,0.08);
}

.as-vp-doc-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(61, 139, 147, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--as-cyan-light);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.as-vp-doc-body {
    flex: 1;
    min-width: 0;
}

.as-vp-doc-title {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.as-vp-doc-meta {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
}

/* Responsive: stack on mobile */
@media (max-width: 991px) {
    .as-vp-layout {
        grid-template-columns: 1fr;
    }

    .as-vp-sidebar {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .as-vp-player {
        border-radius: 0;
    }

    .as-vp-skip-btn {
        opacity: 1;
    }

    .as-vp-controls {
        opacity: 1;
    }

    .as-vp-tab-btn {
        font-size: 0.75rem;
        padding: var(--as-space-2) var(--as-space-1);
    }
}

/* ========================================
   Ltype-F Components (Chat)
   ======================================== */

/* 3-column layout: sidebar | chat | evidence */
.as-chat-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Session sidebar */
.as-chat-sidebar {
    width: 260px;
    border-right: 1px solid var(--as-border);
    display: flex;
    flex-direction: column;
    background: var(--as-bg-secondary);
    flex-shrink: 0;
}

.as-chat-sidebar-header {
    padding: var(--as-space-3) var(--as-space-4);
    border-bottom: 1px solid var(--as-border);
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
}

.as-chat-sidebar-header h3 {
    margin: 0;
    font-size: var(--as-text-sm);
    flex: 1;
}

.as-chat-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--as-space-1);
}

.as-chat-session-item {
    padding: var(--as-space-3);
    cursor: pointer;
    border-radius: var(--as-radius);
    margin: 2px 0;
    font-size: var(--as-text-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: background var(--as-transition-fast);
}

.as-chat-session-item:hover {
    background: rgba(61, 139, 147, 0.05);
}

.as-chat-session-item.as-active {
    background: rgba(78, 189, 196, 0.12);
    border-left: 3px solid var(--as-primary);
}

.as-chat-session-title {
    font-weight: var(--as-font-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-chat-session-meta {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
}

/* Main chat container */
.as-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* Sticky toolbar */
.as-chat-toolbar {
    padding: var(--as-space-2) var(--as-space-4);
    border-bottom: 1px solid var(--as-border);
    display: flex;
    align-items: center;
    gap: var(--as-space-3);
    background: var(--as-card-bg);
    flex-shrink: 0;
}

.as-chat-toolbar select {
    padding: 6px 10px;
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius);
    font-size: var(--as-text-sm);
    background: var(--as-card-bg);
    color: var(--as-text);
}

/* Scrollable messages area */
.as-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--as-space-4);
    display: flex;
    flex-direction: column;
    gap: var(--as-space-3);
}

/* Chat bubbles */
.as-chat-bubble {
    max-width: 80%;
    padding: var(--as-space-3) var(--as-space-4);
    border-radius: 12px;
    line-height: 1.6;
    font-size: var(--as-text-base);
}

.as-chat-bubble--user {
    align-self: flex-end;
    background: var(--as-teal);
    color: var(--as-text-inverse);
    border-bottom-right-radius: 4px;
}

.as-chat-bubble--assistant {
    align-self: flex-start;
    background: var(--as-bg-secondary);
    border: 1px solid var(--as-border);
    border-bottom-left-radius: 4px;
}

.as-chat-bubble--system {
    align-self: center;
    background: rgba(245, 158, 11, 0.1);
    font-size: var(--as-text-sm);
    padding: 6px var(--as-space-3);
    border-radius: 20px;
}

.as-chat-bubble .msg-content {
    word-wrap: break-word;
}

.as-chat-bubble .msg-content pre {
    background: #263238;
    color: #eee;
    padding: var(--as-space-3);
    border-radius: var(--as-radius);
    overflow-x: auto;
    font-size: var(--as-text-sm);
}

.as-chat-bubble .msg-content code {
    background: var(--as-bg-secondary);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: var(--as-text-sm);
}

.as-chat-bubble .msg-meta {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
    margin-top: 6px;
}

/* Evidence container (inline badges under assistant bubble) */
.as-evidence-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--as-space-2);
    margin-top: var(--as-space-3);
    padding-top: var(--as-space-3);
    border-top: 1px solid var(--as-border-light);
}

.as-evidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: var(--as-space-2) var(--as-space-4);
    border-radius: var(--as-radius-md);
    font-size: var(--as-text-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--as-transition-fast), transform var(--as-transition-fast), box-shadow var(--as-transition-fast);
}

.as-evidence-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--as-shadow-hover);
}

.as-evidence-badge--video {
    background: rgba(78, 189, 196, 0.1);
    border-color: var(--as-cyan-light);
    color: #1a6e75;
}

.as-evidence-badge--video:hover {
    background: var(--as-cyan-light);
    color: var(--as-text-inverse);
}

.as-evidence-badge--public {
    background: rgba(61, 139, 147, 0.1);
    border-color: var(--as-teal);
    color: #2a6e76;
}

.as-evidence-badge--public:hover {
    background: var(--as-teal);
    color: var(--as-text-inverse);
}

.as-evidence-badge--internal {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--as-warning);
    color: #92600a;
}

.as-evidence-badge--internal:hover {
    background: var(--as-warning);
    color: var(--as-text-inverse);
}

.as-evidence-badge-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Sticky input area */
.as-chat-input-area {
    border-top: 1px solid var(--as-border);
    padding: var(--as-space-4);
    background: var(--as-card-bg);
    display: flex;
    gap: var(--as-space-2);
    align-items: flex-end;
    flex-shrink: 0;
}

.as-chat-input-area textarea {
    flex: 1;
    resize: none;
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-md);
    padding: var(--as-space-3);
    font-size: var(--as-text-base);
    font-family: inherit;
    max-height: 150px;
    min-height: 44px;
    line-height: 1.5;
    color: var(--as-text);
    background: var(--as-card-bg);
}

.as-chat-input-area textarea:focus {
    outline: none;
    border-color: var(--as-teal);
    box-shadow: 0 0 0 2px rgba(61, 139, 147, 0.15);
}

.as-chat-send-btn {
    min-width: 44px;
    min-height: 44px;
    padding: var(--as-space-2);
    background: var(--as-teal);
    color: var(--as-text-inverse);
    border: none;
    border-radius: var(--as-radius-md);
    cursor: pointer;
    font-size: 1.125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--as-transition-fast), transform var(--as-transition-fast);
}

.as-chat-send-btn:hover {
    background: #357a81;
    transform: translateY(-1px);
}

.as-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.as-chat-mic-btn {
    min-width: 44px;
    min-height: 44px;
    padding: var(--as-space-2);
    background: none;
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-md);
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--as-transition-fast);
}

.as-chat-mic-btn.recording {
    background: var(--as-error);
    color: var(--as-text-inverse);
    border-color: var(--as-error);
    animation: as-mic-pulse 1.5s ease-in-out infinite;
}

@keyframes as-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(220, 53, 69, 0); }
}

/* Voice recording state bar */
.as-chat-voice-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(220, 53, 69, 0.08);
    border-radius: var(--as-radius);
    font-size: 12px;
    color: var(--as-error);
    margin-bottom: 4px;
}

.as-chat-voice-bar.as-active {
    display: flex;
}

.as-chat-voice-bar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--as-error);
    animation: as-mic-dot-blink 1s ease-in-out infinite;
}

@keyframes as-mic-dot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

.as-chat-voice-bar-levels {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 16px;
}

.as-chat-voice-bar-levels span {
    width: 3px;
    background: var(--as-error);
    border-radius: 2px;
    transition: height 0.1s;
}

/* TTS active state */
.as-chat-tts-btn.active {
    background: var(--as-primary) !important;
    color: var(--as-text-inverse) !important;
    border-color: var(--as-primary) !important;
}

/* Video cards in chat messages */
.as-chat-video-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.as-chat-video-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--as-surface-secondary);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius);
    cursor: pointer;
    text-decoration: none;
    color: var(--as-text);
    transition: background var(--as-transition-fast), border-color var(--as-transition-fast);
    max-width: 320px;
    min-width: 200px;
}

.as-chat-video-card:hover {
    background: var(--as-surface-hover);
    border-color: var(--as-primary);
}

.as-chat-video-card-thumb {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    background: var(--as-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--as-primary);
    font-size: 18px;
}

.as-chat-video-card-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.as-chat-video-card-title {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-chat-video-card-meta {
    font-size: 11px;
    color: var(--as-text-muted);
}

.as-chat-video-card-play {
    font-size: 14px;
    color: var(--as-primary);
}

/* Typing indicator (bounce wave) */
.as-typing-indicator {
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    padding: 4px 0;
    height: 24px;
}

.as-typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--as-text-muted);
    border-radius: 50%;
    animation: as-typing-bounce 1.4s ease-in-out infinite;
}

.as-typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.as-typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes as-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Evidence detail panel (right drawer) */
.as-chat-evidence-panel {
    width: 300px;
    border-left: 1px solid var(--as-border);
    display: none;
    flex-direction: column;
    background: var(--as-bg-secondary);
    flex-shrink: 0;
}

.as-chat-evidence-panel.as-open {
    display: flex;
}

.as-chat-evidence-panel-header {
    padding: var(--as-space-3) var(--as-space-4);
    border-bottom: 1px solid var(--as-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.as-chat-evidence-panel-header h3 {
    margin: 0;
    font-size: var(--as-text-sm);
}

.as-chat-evidence-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--as-text-secondary);
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.as-chat-evidence-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--as-space-2);
}

.as-chat-evidence-item {
    padding: var(--as-space-3);
    margin: var(--as-space-1) 0;
    border-radius: var(--as-radius);
    background: var(--as-card-bg);
    border: 1px solid var(--as-border);
    font-size: var(--as-text-sm);
}

.as-chat-evidence-item .ev-title {
    font-weight: var(--as-font-semibold);
    margin-bottom: 4px;
}

.as-chat-evidence-item .ev-type {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
    text-transform: uppercase;
}

.as-chat-evidence-item .ev-score {
    font-size: var(--as-text-xs);
    background: rgba(78, 189, 196, 0.12);
    padding: 1px 6px;
    border-radius: 10px;
}

.as-chat-evidence-item .ev-snippet {
    margin-top: 6px;
    color: var(--as-text-secondary);
    line-height: 1.4;
}

/* Large modal variant for infographic template selection */
.as-modal--lg {
    max-width: 960px;
    width: 95%;
}

/* Infographic trigger button (inside chat bubble) */
.as-chat-infographic-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: var(--as-space-2) var(--as-space-4);
    margin-top: var(--as-space-2);
    border: 1px solid var(--as-teal);
    border-radius: var(--as-radius-md);
    background: transparent;
    color: var(--as-teal);
    font-size: var(--as-text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--as-transition-fast), color var(--as-transition-fast), transform var(--as-transition-fast);
}

.as-chat-infographic-trigger:hover {
    background: var(--as-teal);
    color: var(--as-text-inverse);
    transform: translateY(-1px);
    box-shadow: var(--as-shadow-hover);
}

.as-chat-infographic-trigger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Template grid */
.as-infographic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--as-space-4);
}

/* Template card */
.as-infographic-tpl-card {
    border: 2px solid var(--as-border);
    border-radius: var(--as-radius-md);
    background: var(--as-card-bg);
    cursor: pointer;
    transition: border-color var(--as-transition-fast), transform var(--as-transition-fast), box-shadow var(--as-transition-fast);
    overflow: hidden;
}

.as-infographic-tpl-card:hover {
    border-color: var(--as-cyan-light);
    transform: translateY(-2px);
    box-shadow: var(--as-shadow-hover);
}

.as-infographic-tpl-card.as-selected {
    border-color: var(--as-teal);
    box-shadow: 0 0 0 2px rgba(61, 139, 147, 0.2);
}

.as-infographic-tpl-thumb {
    aspect-ratio: 4 / 3;
    background: var(--as-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--as-text-muted);
    position: relative;
}

.as-infographic-tpl-card.as-selected .as-infographic-tpl-thumb::after {
    content: '\2713';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--as-teal);
    color: var(--as-text-inverse);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.as-infographic-tpl-info {
    padding: var(--as-space-3);
}

.as-infographic-tpl-name {
    font-weight: var(--as-font-semibold);
    font-size: var(--as-text-sm);
    color: var(--as-text);
    margin-bottom: 2px;
}

.as-infographic-tpl-size {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
}

/* Progress state */
.as-infographic-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--as-space-4);
    padding: var(--as-space-8) var(--as-space-4);
    min-height: 320px;
}

.as-infographic-progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--as-bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.as-infographic-progress-fill {
    height: 100%;
    background: var(--as-teal);
    border-radius: 4px;
    transition: width 0.6s ease;
    width: 0%;
}

.as-infographic-progress-step {
    font-size: var(--as-text-base);
    color: var(--as-text-secondary);
    text-align: center;
}

.as-infographic-skeleton {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 4 / 3;
    border-radius: var(--as-radius-md);
    background: linear-gradient(90deg, var(--as-bg-secondary) 25%, var(--as-border-light) 50%, var(--as-bg-secondary) 75%);
    background-size: 200% 100%;
    animation: as-skeleton-pulse 1.5s ease-in-out infinite;
}

/* Result state */
.as-infographic-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--as-space-4);
}

.as-infographic-result-svg {
    max-width: 100%;
    overflow: auto;
}

/* Modal state visibility */
.as-infographic-state { display: none; }
.as-infographic-state.as-active { display: block; }
.as-infographic-progress.as-active { display: flex; }

/* Responsive: mobile */
@media (max-width: 768px) {
    .as-chat-sidebar {
        display: none;
    }

    .as-chat-evidence-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 10;
    }

    .as-chat-bubble {
        max-width: 95%;
    }
}

/* Reduced motion for chat */
@media (prefers-reduced-motion: reduce) {
    .as-typing-indicator span {
        animation: none;
        opacity: 0.6;
    }

    .as-evidence-badge,
    .as-chat-send-btn {
        transition: none;
    }

    .as-evidence-badge:hover,
    .as-chat-send-btn:hover {
        transform: none;
    }
}

/* ========================================
   Ltype-K Components (Wizard)
   ======================================== */
.as-wizard-steps {
    display: flex;
    justify-content: center;
    gap: var(--as-space-2);
    padding: var(--as-space-4) 0;
}

.as-wizard-step {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    font-size: var(--as-text-sm);
    color: var(--as-text-muted);
}

.as-wizard-step.as-active {
    color: var(--as-primary);
    font-weight: var(--as-font-semibold);
}

.as-wizard-step.as-completed {
    color: var(--as-success);
}

.as-wizard-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--as-text-sm);
    font-weight: var(--as-font-semibold);
    background: var(--as-border);
    color: var(--as-text-muted);
}

.as-wizard-step.as-active .as-wizard-step-number {
    background: var(--as-primary);
    color: var(--as-text-inverse);
}

.as-wizard-step.as-completed .as-wizard-step-number {
    background: var(--as-success);
    color: var(--as-text-inverse);
}

.as-wizard-connector {
    width: 32px;
    height: 2px;
    background: var(--as-border);
}

.as-wizard-connector.as-completed {
    background: var(--as-success);
}

.as-wizard-content {
    flex: 1;
}

.as-wizard-actions {
    display: flex;
    justify-content: space-between;
    padding: var(--as-space-4);
    border-top: 1px solid var(--as-border);
    position: sticky;
    bottom: 0;
    background: var(--as-card-bg);
    z-index: 10;
}

/* ========================================
   Estimation Wizard (as-est-*)
   ======================================== */

/* 金額入力フィールド: 右寄せ */
.as-est-amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* 明細テーブル */
.as-est-items-table {
    width: 100%;
    border-collapse: collapse;
}

.as-est-items-table th {
    font-size: var(--as-text-xs);
    color: var(--as-text-secondary);
    font-weight: 600;
    padding: var(--as-space-2) var(--as-space-3);
    text-align: left;
    border-bottom: 2px solid var(--as-border);
}

.as-est-items-table th.as-est-amount { text-align: right; }

.as-est-items-table td {
    padding: var(--as-space-2) var(--as-space-3);
    border-bottom: 1px solid var(--as-border-light);
    vertical-align: middle;
}

.as-est-items-table td:last-child { text-align: center; }

.as-est-items-table .as-form-input {
    font-size: var(--as-text-sm);
    padding: var(--as-space-1) var(--as-space-2);
}

.as-est-add-item-btn {
    margin-top: var(--as-space-3);
}

/* サマリーカード (Step3 リアルタイム計算) */
.as-est-calc-summary {
    background: var(--as-bg-secondary);
    border-radius: var(--as-radius);
    padding: var(--as-space-4);
}

.as-est-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--as-space-1) 0;
}

.as-est-calc-label {
    font-size: var(--as-text-sm);
    color: var(--as-text-secondary);
}

.as-est-calc-value {
    font-size: var(--as-text-base);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.as-est-calc-row--total {
    border-top: 2px solid var(--as-border);
    padding-top: var(--as-space-3);
    margin-top: var(--as-space-2);
}

.as-est-calc-row--total .as-est-calc-value {
    font-size: 1.125rem;
    color: var(--as-primary);
}

/* Step4 確認画面 */
.as-est-confirm-section {
    margin-bottom: var(--as-space-4);
}

.as-est-confirm-section h4 {
    font-size: var(--as-text-sm);
    color: var(--as-text-secondary);
    margin-bottom: var(--as-space-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.as-est-confirm-section h4 .as-btn-link {
    font-size: var(--as-text-xs);
    color: var(--as-primary);
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
}

.as-est-confirm-dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--as-space-1) var(--as-space-4);
    font-size: var(--as-text-sm);
}

.as-est-confirm-dl dt {
    color: var(--as-text-secondary);
}

.as-est-confirm-dl dd {
    color: var(--as-text-primary);
    font-weight: 500;
}

.as-est-confirm-calc {
    margin-top: var(--as-space-3);
}

/* ========================================
   Ltype-H Components (Master-Detail)
   ======================================== */
.as-master-list {
    border-right: 1px solid var(--as-border);
    overflow-y: auto;
    background: var(--as-bg-secondary);
}

.as-master-list-item {
    padding: var(--as-space-3) var(--as-space-4);
    border-bottom: 1px solid var(--as-border-light);
    cursor: pointer;
    transition: background var(--as-transition-fast);
}

.as-master-list-item:hover {
    background: rgba(61, 139, 147, 0.05);
}

.as-master-list-item.as-active {
    background: rgba(78, 189, 196, 0.12);
    border-left: 3px solid var(--as-primary);
}

.as-layout-master-detail .as-detail-panel {
    position: static;
    width: auto;
    height: auto;
    transform: none;
    box-shadow: none;
    z-index: auto;
    display: block;
    overflow-y: auto;
    padding: var(--as-space-6);
    background: var(--as-card-bg);
}

/* Master-list header (search + filter) */
.as-master-list-header {
    padding: var(--as-space-3) var(--as-space-4);
    border-bottom: 1px solid var(--as-border);
    display: flex;
    flex-direction: column;
    gap: var(--as-space-2);
    background: var(--as-bg-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.as-master-list-header input,
.as-master-list-header select {
    width: 100%;
    padding: var(--as-space-2) var(--as-space-3);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius);
    font-size: var(--as-text-sm);
    background: var(--as-card-bg);
    color: var(--as-text);
}

/* Invoice amount hero display */
.as-invoice-amount-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--as-space-4) var(--as-space-6);
    background: var(--as-card-bg);
    border: 1px solid var(--as-border);
    border-radius: var(--as-radius-lg);
    margin-bottom: var(--as-space-4);
}

.as-invoice-amount-hero .as-hero-amount {
    font-size: var(--as-text-2xl);
    font-weight: 700;
    color: var(--as-text);
    line-height: 1.2;
}

.as-invoice-amount-hero .as-hero-amount-label {
    font-size: var(--as-text-sm);
    color: var(--as-text-muted);
    margin-top: var(--as-space-1);
}

.as-invoice-amount-hero .as-hero-due {
    text-align: right;
    font-size: var(--as-text-sm);
    color: var(--as-text-secondary);
}

.as-invoice-amount-hero .as-hero-due.as-overdue {
    color: var(--as-error);
    font-weight: var(--as-font-semibold);
}

/* Detail actions with 44px touch target */
.as-detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: var(--as-space-4);
}

.as-detail-actions .as-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Master list item layout for invoice */
.as-master-list-item .as-mli-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.as-master-list-item .as-mli-number {
    font-weight: var(--as-font-semibold);
    font-size: var(--as-text-sm);
    color: var(--as-text);
}

.as-master-list-item .as-mli-amount {
    font-weight: var(--as-font-semibold);
    font-size: var(--as-text-sm);
    color: var(--as-text);
}

.as-master-list-item .as-mli-vendor {
    font-size: var(--as-text-xs);
    color: var(--as-text-secondary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-master-list-item .as-mli-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.as-master-list-item .as-mli-date {
    font-size: var(--as-text-xs);
    color: var(--as-text-muted);
}

/* Detail empty state */
.as-detail-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: var(--as-text-lg);
    color: var(--as-text-muted);
}

/* ========================================
   Ltype-E Components (Grid)
   ======================================== */
.as-grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--as-space-4);
}

/* ========================================
   Ltype-E: Video Card Gallery (as-vc-*)
   ======================================== */

/* Filter bar */
.as-vc-filters {
    display: flex;
    align-items: center;
    gap: var(--as-space-3);
    margin-bottom: var(--as-space-4);
    flex-wrap: wrap;
}

.as-vc-search {
    flex: 1;
    min-width: 200px;
    min-height: 44px;
    padding: 0 var(--as-space-3);
    border: 1px solid var(--as-border-default);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: var(--as-font);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.as-vc-search:focus {
    border-color: var(--as-primary);
    box-shadow: 0 0 0 3px rgba(61, 139, 147, 0.15);
}

.as-vc-select {
    min-height: 44px;
    padding: 0 var(--as-space-3);
    border: 1px solid var(--as-border-default);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: var(--as-font);
    background: var(--as-card-bg);
    color: var(--as-text);
    cursor: pointer;
    outline: none;
    min-width: 130px;
    transition: border-color 0.2s;
}

.as-vc-select:focus {
    border-color: var(--as-primary);
}

/* Results info */
.as-vc-results-info {
    font-size: 0.85rem;
    color: var(--as-text-muted);
    margin-bottom: var(--as-space-3);
}

/* Card grid — responsive columns */
.as-vc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--as-space-4);
}

@media (max-width: 1200px) {
    .as-vc-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 991px) {
    .as-vc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 576px) {
    .as-vc-grid { grid-template-columns: 1fr; }
    .as-vc-filters { flex-direction: column; }
    .as-vc-search { min-width: 100%; }
    .as-vc-select { width: 100%; }
}

/* Video card */
.as-vc-card {
    background: var(--as-card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--as-shadow-sm);
    transition: box-shadow 0.25s, transform 0.25s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.as-vc-card:hover {
    box-shadow: var(--as-shadow-hover);
    transform: translateY(-2px);
}

/* Thumbnail area */
.as-vc-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--as-gray-light);
}

.as-vc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.as-vc-card:hover .as-vc-thumb img {
    transform: scale(1.08);
}

/* Placeholder when no real thumbnail */
.as-vc-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--as-navy) 0%, var(--as-teal) 100%);
    color: rgba(255,255,255,0.3);
    font-size: 2.5rem;
    transition: transform 0.4s ease;
}

.as-vc-card:hover .as-vc-thumb-placeholder {
    transform: scale(1.08);
}

.as-vc-thumb-label {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    text-align: left;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.as-vc-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.as-vp-chapter-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.as-vp-empty-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--as-text-muted, #888);
    font-size: 0.85rem;
    text-align: center;
}

.as-vp-empty-tab i {
    font-size: 1.5rem;
    opacity: 0.5;
}

/* Play overlay on hover */
.as-vc-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(27, 58, 75, 0.45);
    opacity: 0;
    transition: opacity 0.3s;
}

.as-vc-card:hover .as-vc-play-overlay {
    opacity: 1;
}

.as-vc-play-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--as-navy);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.as-vc-card:hover .as-vc-play-icon {
    transform: scale(1.08);
}

/* Duration badge (bottom-right of thumbnail) */
.as-vc-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    z-index: 2;
}

/* AI analyzed badge (top-right of thumbnail) */
.as-vc-badge-ai {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(78, 189, 196, 0.9);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
    backdrop-filter: blur(4px);
}

/* Card body (metadata) */
.as-vc-body {
    padding: var(--as-space-3);
    display: flex;
    flex-direction: column;
    gap: var(--as-space-1);
    flex: 1;
}

.as-vc-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--as-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.as-vc-meta {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    font-size: 0.78rem;
    color: var(--as-text-muted);
    flex-wrap: wrap;
}

.as-vc-meta-separator::before {
    content: '\00b7';
    margin: 0 2px;
}

.as-vc-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: var(--as-space-1);
}

.as-vc-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--as-gray-light);
    color: var(--as-text-secondary);
    white-space: nowrap;
}

/* Difficulty indicator */
.as-vc-difficulty {
    font-size: 0.75rem;
    font-weight: 500;
}

.as-vc-difficulty-beginner { color: var(--as-success); }
.as-vc-difficulty-intermediate { color: var(--as-info); }
.as-vc-difficulty-advanced { color: var(--as-warning); }
.as-vc-difficulty-expert { color: var(--as-error); }

/* Load more / pagination footer */
.as-vc-footer {
    display: flex;
    justify-content: center;
    padding: var(--as-space-6) 0 var(--as-space-2);
}

.as-vc-load-more {
    min-height: 44px;
    min-width: 200px;
    padding: 0 var(--as-space-6);
    border: 2px solid var(--as-teal);
    border-radius: 6px;
    background: transparent;
    color: var(--as-teal);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: var(--as-font);
}

.as-vc-load-more:hover {
    background: var(--as-teal);
    color: var(--as-white);
}

.as-vc-load-more:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Empty state */
.as-vc-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--as-space-8) var(--as-space-4);
    color: var(--as-text-muted);
    font-size: 0.95rem;
}

.as-vc-empty i {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--as-space-3);
    opacity: 0.3;
}

/* ========================================
   Dashboard (as-db-*)
   ======================================== */

/* Stat icon background utilities */
.as-bg-primary-subtle { background: rgba(61, 139, 147, 0.1); color: var(--as-primary); }
.as-bg-success-subtle { background: rgba(16, 185, 129, 0.1); color: var(--as-success); }
.as-bg-warning-subtle { background: rgba(245, 158, 11, 0.1); color: var(--as-warning); }
.as-bg-error-subtle   { background: rgba(239, 68, 68, 0.1);  color: var(--as-error); }

/* Section: full-width inside Ltype-E grid */
.as-db-section {
    grid-column: 1 / -1;
}

/* Quick Actions */
.as-db-quick-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.as-db-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--as-primary);
    border-radius: var(--as-radius-md, 0.5rem);
    background: var(--as-white);
    color: var(--as-primary);
    font-size: var(--as-text-sm, 0.875rem);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.as-db-action-btn:hover {
    background: rgba(61, 139, 147, 0.05);
    box-shadow: var(--as-shadow-hover);
}

.as-db-action-primary {
    background: var(--as-gradient);
    color: var(--as-white);
    border-color: transparent;
}

.as-db-action-primary:hover {
    opacity: 0.92;
    box-shadow: var(--as-shadow-hover);
}

/* Stat Row (4 columns) */
.as-db-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--as-space-4, 1rem);
}

/* KPI Row (3 columns) */
.as-db-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--as-space-4, 1rem);
}

/* KPI Card */
.as-db-kpi-card {
    background: var(--as-white);
    border: 1px solid var(--as-border-light);
    border-left: 4px solid var(--as-primary);
    border-radius: var(--as-radius-md, 0.5rem);
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.as-db-kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(27, 58, 75, 0.12);
}

.as-db-kpi-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--as-text-secondary);
    font-size: var(--as-text-sm, 0.875rem);
}

.as-db-kpi-header i {
    font-size: 1.25rem;
}

.as-db-kpi-value {
    font-size: var(--as-text-2xl, 1.5rem);
    font-weight: 700;
    color: var(--as-navy);
    line-height: 1.2;
}

.as-db-trend {
    margin-top: 0.5rem;
    font-size: var(--as-text-sm, 0.875rem);
    font-weight: 500;
}

.as-db-trend--up {
    color: var(--as-success);
}

.as-db-trend--down {
    color: var(--as-error);
}

/* Health Grid */
.as-db-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.as-db-health-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.as-db-health-item strong {
    font-size: var(--as-text-sm, 0.875rem);
    color: var(--as-text-secondary);
}

.as-db-health-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.as-db-health-badge--ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--as-success);
}

.as-db-health-badge--error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--as-error);
}

/* Responsive: md */
@media (max-width: 991px) {
    .as-db-stat-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .as-db-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive: sm */
@media (max-width: 767px) {
    .as-db-stat-row,
    .as-db-kpi-row {
        grid-template-columns: 1fr;
    }
    .as-db-quick-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .as-sidebar-title::after,
    .as-sidebar-section .as-sidebar-nav {
        transition: none;
    }

    .as-profile-chevron {
        transition: none;
    }

    .as-profile-dropdown {
        animation: none;
    }

    .as-card,
    .as-stat-card,
    .as-sidebar-nav li a,
    .as-table tbody tr,
    .as-btn {
        transition: none;
    }

    .as-stat-card:hover {
        transform: none;
    }

    .as-skeleton {
        animation: none;
    }

    .as-btn-loading::after {
        animation: none;
    }

    .as-db-kpi-card,
    .as-db-action-btn {
        transition: none;
    }

    .as-db-kpi-card:hover {
        transform: none;
    }
}

/* ========================================
   Ltype-R Components (Kanban Board)
   ======================================== */

/* Main board: horizontal flex with scroll */
.as-layout-kanban .as-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.as-layout-kanban .as-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.as-kanban-board {
    display: flex;
    gap: var(--as-space-4);
    overflow-x: auto;
    flex: 1;
    min-height: 0;
    padding: 0 var(--as-space-4) var(--as-space-4);
    align-items: flex-start;
}

/* Column */
.as-kanban-col {
    min-width: 260px;
    max-width: 320px;
    flex: 1 0 260px;
    display: flex;
    flex-direction: column;
    background: var(--as-bg-secondary);
    border-radius: var(--as-radius-md);
    border-top: 3px solid var(--as-border);
    max-height: calc(100vh - 200px);
}

.as-kanban-col-header {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    padding: var(--as-space-3) var(--as-space-4);
    font-weight: var(--as-font-semibold);
    font-size: var(--as-text-sm);
    color: var(--as-text-secondary);
    flex-wrap: wrap;
}

.as-kanban-col-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 9999px;
    background: var(--as-primary);
    color: var(--as-text-inverse);
    font-size: 0.7rem;
    font-weight: var(--as-font-bold);
}

.as-kanban-col-amount {
    width: 100%;
    font-size: 0.7rem;
    color: var(--as-text-muted);
    font-weight: var(--as-font-normal);
    padding: 0 var(--as-space-4) var(--as-space-2);
}

/* Scrollable card list */
.as-kanban-col-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--as-space-2) var(--as-space-3) var(--as-space-3);
    display: flex;
    flex-direction: column;
    gap: var(--as-space-2);
    min-height: 60px;
}

/* Card */
.as-kanban-card {
    background: var(--as-white);
    border: 1px solid var(--as-border-light);
    border-radius: var(--as-radius-md);
    padding: var(--as-space-3);
    cursor: grab;
    transition: transform var(--as-transition-fast), box-shadow var(--as-transition-fast);
    user-select: none;
}

.as-kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--as-shadow-hover);
}

.as-kanban-card-name {
    font-weight: var(--as-font-semibold);
    font-size: var(--as-text-sm);
    color: var(--as-navy);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--as-space-1);
}

.as-kanban-card-project {
    font-size: 0.75rem;
    color: var(--as-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--as-space-1);
}

.as-kanban-card-amount {
    font-size: var(--as-text-sm);
    font-weight: var(--as-font-semibold);
    color: var(--as-primary);
}

.as-kanban-card-meta {
    display: flex;
    align-items: center;
    gap: var(--as-space-2);
    margin-top: var(--as-space-2);
    font-size: 0.7rem;
    color: var(--as-text-muted);
}

/* Stale card (14+ days no update) */
.as-kanban-card.as-kanban-stale {
    border-left: 3px solid var(--as-error);
}

.as-kanban-card-stale-icon {
    display: none;
    color: var(--as-error);
    font-size: 0.85rem;
}

.as-kanban-stale .as-kanban-card-stale-icon {
    display: inline;
}

/* Drag states */
.as-kanban-dragging {
    opacity: 0.45;
    transform: rotate(1.5deg);
    cursor: grabbing;
}

.as-kanban-drag-over {
    background: rgba(61, 139, 147, 0.08);
}

/* Lost column */
.as-kanban-col-lost {
    background: #fef2f2;
}

.as-kanban-col-lost .as-kanban-card {
    cursor: default;
}

.as-kanban-col-hidden {
    display: none;
}

/* Stage color accents (border-top) — PLS2015 ClosureAccuracy values */
.as-kanban-col[data-stage="\53C2\8003\898B\7A4D"] { border-top-color: var(--as-text-muted); }
.as-kanban-col[data-stage="20%\4EE5\4E0A"] { border-top-color: var(--as-warning); }
.as-kanban-col[data-stage="50%\4EE5\4E0A"] { border-top-color: var(--as-info); }
.as-kanban-col[data-stage="70%\4EE5\4E0A"] { border-top-color: #3d8b93; }
.as-kanban-col[data-stage="\6210\7D04\6E08"] { border-top-color: var(--as-success); }
.as-kanban-col[data-stage="\8ACB\6C42\66F8\51FA\529B\7528"] { border-top-color: #34d399; }
.as-kanban-col[data-stage="\5931\6CE8"] { border-top-color: var(--as-error); }

/* Skeleton loading */
.as-kanban-skeleton {
    height: 80px;
    border-radius: var(--as-radius-md);
    background: linear-gradient(90deg, var(--as-bg-secondary) 25%, var(--as-border-light) 50%, var(--as-bg-secondary) 75%);
    background-size: 200% 100%;
    animation: as-skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes as-skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Kanban toolbar */
.as-kanban-toolbar {
    display: flex;
    align-items: center;
    gap: var(--as-space-3);
    padding: var(--as-space-3) var(--as-space-4);
    flex-wrap: wrap;
}

.as-kanban-toolbar .as-search-input {
    max-width: 280px;
}

/* Responsive: stack columns vertically on mobile */
@media (max-width: 767px) {
    .as-kanban-board {
        flex-direction: column;
        overflow-x: visible;
    }

    .as-kanban-col {
        min-width: 100%;
        max-width: 100%;
        max-height: none;
    }
}

/* Reduced motion for kanban */
@media (prefers-reduced-motion: reduce) {
    .as-kanban-card {
        transition: none;
    }

    .as-kanban-card:hover {
        transform: none;
    }

    .as-kanban-dragging {
        transform: none;
    }

    .as-kanban-skeleton {
        animation: none;
    }
}
