/* 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');

/* ========================================
   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: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.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);
}

/* 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 */
.as-layout-chat .as-main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--as-header-height) - var(--as-page-title-height));
}

.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;
}

/* Ltype-H: Master-detail (list + detail panel) */
.as-layout-master-detail .as-content {
    display: grid;
    grid-template-columns: 360px 1fr;
    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-F Components (Chat)
   ======================================== */
.as-chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

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

.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;
}

/* ========================================
   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-top: var(--as-space-4);
    border-top: 1px solid var(--as-border);
}

/* ========================================
   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(61, 139, 147, 0.1);
    border-left: 3px solid var(--as-primary);
}

.as-detail-panel {
    overflow-y: auto;
    padding: var(--as-space-6);
}

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

/* ========================================
   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;
    }
}
