/* ===== Design Tokens ===== */
:root {
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.16);
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 64px;
    --header-height: 52px;
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;

    /* Overlay */
    --overlay-bg: rgba(0,0,0,0.4);

    /* Toast colors */
    --toast-success-bg: #f0fdf4;
    --toast-success-border: #bbf7d0;
    --toast-success-text: #166534;
    --toast-error-bg: #fef2f2;
    --toast-error-border: #fecaca;
    --toast-error-text: #991b1b;
    --toast-warning-bg: #fffbeb;
    --toast-warning-border: #fde68a;
    --toast-warning-text: #92400e;
    --toast-info-bg: #eff6ff;
    --toast-info-border: #bfdbfe;
    --toast-info-text: #1e40af;
}

/* ===== Base ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== HTMX Loading Indicators ===== */
.htmx-indicator {
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
    opacity: 1;
}

/* HTMX loading overlay for tables */
.htmx-loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    z-index: 10;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}
.htmx-request .htmx-loading-overlay {
    display: flex;
}

/* Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #8a6145;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toggle Switch ===== */
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 12px;
    transition: background var(--transition-normal);
    flex-shrink: 0;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--transition-normal);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider { background: #22c55e; }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle.disabled { cursor: not-allowed; opacity: 0.5; }
.toggle.disabled input { pointer-events: none; }

/* ===== Modal Overlay ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlay-bg);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5vh;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.2s ease-out;
}
.modal-overlay > div {
    animation: scaleIn 0.2s ease-out;
}

/* Drawer modal (slides in from right) */
.modal-overlay.drawer {
    justify-content: flex-end;
    align-items: stretch;
    padding-top: 0;
}
.modal-overlay.drawer > div {
    animation: slideInRight 0.3s ease-out;
    border-radius: 0;
    max-height: 100vh;
    height: 100vh;
}

/* ===== Searchable Select ===== */
.search-select { position: relative; }
.search-select .search-select-input { width: 100%; }
.search-select-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    background: #fff; border: 1px solid #e2e8f0; border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px; overflow-y: auto; display: none;
    box-shadow: var(--shadow-md);
}
.search-select.open .search-select-dropdown { display: block; }
.search-select.open .form-control { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.search-select-item {
    padding: 8px 14px; cursor: pointer; font-size: 14px;
    border-bottom: 1px solid #f1f5f9; transition: background var(--transition-fast);
}
.search-select-item:last-child { border-bottom: none; }
.search-select-item:hover, .search-select-item.active { background: #eef2ff; }
.search-select-item .item-name { font-weight: 500; }
.search-select-item .item-id { font-size: 11px; color: #94a3b8; font-family: monospace; }
.search-select-empty,
.search-select-loading { padding: 12px 14px; color: #94a3b8; font-size: 13px; text-align: center; }
.search-select-selected { display: flex; align-items: center; gap: 8px; }
.search-select-selected .selected-tag {
    background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 4px;
    padding: 2px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px;
}
.search-select-selected .selected-clear { cursor: pointer; font-size: 14px; color: #94a3b8; line-height: 1; }
.search-select-selected .selected-clear:hover { color: #334155; }
.filter-bar .filter-search-select { min-width: 180px; }
.filter-bar .filter-search-select .search-select-input { width: 100%; }

/* Search-select disabled state (used with data-requires) */
.search-select.search-select-disabled .search-select-input {
    background-color: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

/* Tooltip icon — used inline in form labels */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    font-size: 10px;
    font-style: normal;
    font-weight: 600;
    color: #94a3b8;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
}
.tooltip-icon::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: 250px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 200;
}
.tooltip-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1e293b;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}
.tooltip-icon:hover::after,
.tooltip-icon:hover::before {
    opacity: 1;
}

/* ===== Expandable Detail Row ===== */
.detail-row { display: none; }
.detail-row.open { display: table-row; }
.detail-btn.open { background: #e2e8f0; }

/* ===== Sidebar ===== */
.sidebar-nav {
    width: var(--sidebar-width);
    transition: width var(--transition-slow);
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar-body {
    height: calc(100vh - var(--header-height));
}

.sidebar-collapsed .sidebar-nav {
    width: var(--sidebar-collapsed-width);
}

.sidebar-nav .nav-text,
.sidebar-nav .section-header,
.sidebar-nav .nav-chevron {
    transition: opacity var(--transition-normal);
    white-space: nowrap;
}

.sidebar-collapsed .sidebar-nav .nav-text,
.sidebar-collapsed .sidebar-nav .section-header,
.sidebar-collapsed .sidebar-nav .nav-chevron {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-nav a,
.sidebar-collapsed .sidebar-nav .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

/* Sidebar tooltip on collapsed state */
.sidebar-collapsed .sidebar-nav [data-tooltip] {
    position: relative;
}
.sidebar-collapsed .sidebar-nav [data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-collapsed-width) + 4px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

/* Collapsible nav sections */
.nav-section-items {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}
.nav-section.collapsed .nav-section-items {
    max-height: 0;
}
.nav-section .nav-chevron {
    transition: transform var(--transition-normal);
}
.nav-section.collapsed .nav-chevron {
    transform: rotate(-90deg);
}

/* ===== Toast Notifications ===== */
#toast-container {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.25s ease-out;
    position: relative;
    overflow: hidden;
    font-size: 14px;
    min-width: 300px;
    border: 1px solid transparent;
}
.toast-success {
    background: var(--toast-success-bg);
    color: var(--toast-success-text);
    border-color: var(--toast-success-border);
}
.toast-error {
    background: var(--toast-error-bg);
    color: var(--toast-error-text);
    border-color: var(--toast-error-border);
}
.toast-warning {
    background: var(--toast-warning-bg);
    color: var(--toast-warning-text);
    border-color: var(--toast-warning-border);
}
.toast-info {
    background: var(--toast-info-bg);
    color: var(--toast-info-text);
    border-color: var(--toast-info-border);
}

.toast-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.toast-message { font-size: 13px; opacity: 0.9; }

.toast-close {
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    color: currentColor;
}
.toast-close:hover { opacity: 1; }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: toastProgress linear forwards;
}
.toast-success .toast-progress { background: #22c55e; }
.toast-error .toast-progress { background: #ef4444; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-info .toast-progress { background: #3b82f6; }

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

.toast-exit {
    animation: fadeOut 0.2s ease-in forwards;
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateX(16px); }
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 16px;
}
.breadcrumb a {
    color: #64748b;
    text-decoration: none;
    transition: color var(--transition-fast);
}
.breadcrumb a:hover { color: #8a6145; }
.breadcrumb .breadcrumb-sep { font-size: 11px; color: #cbd5e1; }
.breadcrumb .breadcrumb-current { color: #1e293b; font-weight: 500; }

/* ===== Table Improvements ===== */
.data-table {
    width: 100%;
    font-size: 14px;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table thead th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}
.data-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.data-table tbody tr {
    transition: background var(--transition-fast);
}
.data-table tbody tr:hover { background: #faf7f5; }
.data-table tbody tr:nth-child(even) { background: #fafafa; }
.data-table tbody tr:nth-child(even):hover { background: #faf7f5; }

/* ID cell with copy */
.cell-id {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 12px;
    color: #64748b;
    max-width: 140px;
    cursor: pointer;
    position: relative;
}
.cell-id:hover { color: #8a6145; }
.cell-id .copy-hint {
    display: none;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}
.cell-id:hover .copy-hint { display: inline; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #94a3b8;
}
.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    opacity: 0.4;
}
.empty-state-text { font-size: 14px; font-weight: 500; }
.empty-state-sub { font-size: 13px; margin-top: 4px; opacity: 0.7; }

/* ===== Badges/Tags ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.badge-green { background: #f0fdf4; color: #166534; }
.badge-green::before { background: #22c55e; }
.badge-red { background: #fef2f2; color: #991b1b; }
.badge-red::before { background: #ef4444; }
.badge-blue { background: #eff6ff; color: #1e40af; }
.badge-blue::before { background: #3b82f6; }
.badge-amber { background: #fffbeb; color: #92400e; }
.badge-amber::before { background: #f59e0b; }
.badge-slate { background: #f1f5f9; color: #475569; }
.badge-slate::before { background: #94a3b8; }
.badge-violet { background: #f5f3ff; color: #5b21b6; }
.badge-violet::before { background: #8b5cf6; }

/* ===== Action Buttons ===== */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    position: relative;
}
.btn-action:hover { transform: translateY(-1px); z-index: 10; }
.btn-action[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 50;
}
.btn-action-primary { background: #faf7f5; color: #8a6145; }
.btn-action-primary:hover { background: #f3ede7; }
.btn-action-slate { background: #f1f5f9; color: #475569; }
.btn-action-slate:hover { background: #e2e8f0; }
.btn-action-danger { background: #fef2f2; color: #dc2626; }
.btn-action-danger:hover { background: #fee2e2; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.filter-bar .filter-icon {
    color: #94a3b8;
    flex-shrink: 0;
}
.filter-bar input,
.filter-bar select {
    padding: 7px 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: white;
    transition: border-color var(--transition-fast);
}
.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: #8a6145;
    box-shadow: 0 0 0 2px rgba(138,97,69,0.1);
}
.filter-bar select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}
.filter-clear {
    padding: 7px 12px;
    font-size: 12px;
    color: #64748b;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.filter-clear:hover { background: #fee2e2; color: #dc2626; border-color: #fecaca; }

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: 4px;
}
@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Page Section ===== */
.page-section {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
}
.page-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}
.page-body {
    padding: 20px 24px;
}

/* ===== Login Background ===== */
.login-bg {
    background: linear-gradient(135deg, #231a13 0%, #382b22 40%, #543928 70%, #654530 100%);
    position: relative;
    overflow: hidden;
}
.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 50%, rgba(181,141,113,0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(181,141,113,0.1) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(101,69,48,0.2) 0%, transparent 60%);
}
.login-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23b58d71' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

/* ========================================
   Component Classes - Semantic Shortcuts
   ======================================== */

/* Form input */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(138,97,69,0.2);
    border-color: #8a6145;
}

/* Form label */
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

/* Alert variants */
.alert-error, .alert-success, .alert-warning, .alert-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
}
.alert-error   { background: var(--toast-error-bg);   color: #b91c1c; border-color: var(--toast-error-border); }
.alert-success { background: var(--toast-success-bg); color: #166534; border-color: var(--toast-success-border); }
.alert-warning { background: var(--toast-warning-bg); color: #92400e; border-color: var(--toast-warning-border); }
.alert-info    { background: var(--toast-info-bg);    color: #1e40af; border-color: var(--toast-info-border); }

/* Alert icon */
.alert-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}


/* Badge label - filter/tab style */
.badge-label {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
    border-radius: 0.25rem;
    transition: color 0.15s, background-color 0.15s;
}
.badge-label:hover {
    color: var(--color-primary-700, #6d4d37);
    background-color: var(--color-primary-50, #faf7f5);
}

/* Inline form */
.form-inline {
    display: inline;
}


/* Secondary text */
.text-muted {
    font-size: 0.75rem;
    color: #64748b;
}

/* Spinner small */
.spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

/* ===== Sidebar Mobile ===== */
@media (max-width: 768px) {
    .sidebar-nav { display: none; }
    .sidebar-nav.open { display: block; position: fixed; top: var(--header-height); left: 0; z-index: 40; height: calc(100vh - var(--header-height)); box-shadow: var(--shadow-xl); }
    .sidebar-collapsed .sidebar-nav { width: var(--sidebar-width); }
}

/* ===== Copied toast ===== */
.copy-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 13px;
    z-index: 3000;
    animation: fadeIn 0.15s ease-out;
    pointer-events: none;
}

/* ===== Top Progress Bar ===== */
.top-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 9999;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}
body.htmx-loading .top-progress {
    opacity: 1;
    animation: htmx-progress 2s ease-out forwards;
}
@keyframes htmx-progress {
    0% { width: 0; }
    80% { width: 90%; }
    100% { width: 95%; }
}

/* ===== Modal Component Classes ===== */
.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 1.5rem;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-content-sm { max-width: 24rem; }
.modal-content-md { max-width: 28rem; }
.modal-content-lg { max-width: 32rem; }
.modal-content-xl { max-width: 42rem; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}
.modal-close {
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}
.modal-close:hover { color: #475569; }

/* ===== Confirm Dialog ===== */
#confirm-dialog {
    border: none;
    padding: 0;
    margin: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 24rem;
    width: calc(100% - 2rem);
    animation: scaleIn 0.2s ease-out;
}
#confirm-dialog::backdrop {
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
}

.confirm-modal { padding: 0; }
.confirm-accent {
    height: 3px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.confirm-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    padding: 1.25rem 1.5rem 0;
}
.confirm-message {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
    padding: 0.5rem 1.5rem 0;
}
.confirm-buttons {
    display: flex;
    gap: 0.625rem;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
}
.confirm-btn-cancel, .confirm-btn-confirm {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: opacity var(--transition-fast);
}
.confirm-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}
.confirm-btn-cancel:hover { background: #e2e8f0; }
.confirm-btn-confirm { color: white; }
.confirm-btn-confirm:hover { opacity: 0.9; }

/* Severity variants */
.confirm-normal .confirm-accent  { background: #3b82f6; }
.confirm-normal .confirm-btn-confirm { background: #3b82f6; }
.confirm-warning .confirm-accent { background: #f59e0b; }
.confirm-warning .confirm-btn-confirm { background: #f59e0b; }
.confirm-danger .confirm-accent  { background: #ef4444; }
.confirm-danger .confirm-btn-confirm { background: #ef4444; }

/* ===== Table Fade During HTMX Reload ===== */
[data-refresh-url].htmx-request,
.htmx-request > table {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 150ms ease;
}

/* ===== Duration Preset Chips ===== */
.duration-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.duration-chip {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 9999px;
    border: 1px solid #cbd5e1;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.duration-chip:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.duration-chip.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.duration-hint {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 0.25rem;
}
