/* KATTO ERP — Streamlined app UI (AERO + KEYGEN compatible) */

.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.app-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-right: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 2px 0 16px rgba(0, 40, 80, 0.12);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(255, 255, 255, 0.7);
}

.sidebar-link.active {
    background: linear-gradient(180deg, #fff 0%, #e8f4fc 100%);
    border-color: #9cc9e8;
    box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(0, 0, 0, 0.06);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-link .nav-icon {
    width: 22px;
    text-align: center;
    font-size: 14px;
    opacity: 0.85;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
}

.app-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}

.sidebar-toggle {
    display: none;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 16px;
}

.topbar-search { flex: 1; max-width: 360px; }
.topbar-search form { display: flex; gap: 6px; }

.topbar-search input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    outline: none;
}

.topbar-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 120, 215, 0.15);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.page-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.data-card {
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s, box-shadow 0.15s;
}

.data-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.data-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 0;
}

.data-card-title { font-size: 15px; font-weight: 600; }
.data-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.data-card-price {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.data-card-price small { font-size: 11px; font-weight: 500; opacity: 0.7; }

.data-card-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
}

.data-card-metrics .metric {
    flex: 1 1 40%;
    min-width: 90px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.data-card-metrics .metric span {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.data-card-metrics .metric strong { font-size: 14px; }

.data-card-metrics .metric.highlight {
    background: rgba(0, 120, 215, 0.08);
    border-color: rgba(0, 120, 215, 0.2);
}

.data-card-note {
    padding: 0 16px 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.data-card-details { margin: 0 16px 12px; font-size: 12px; }
.data-card-details summary { cursor: pointer; color: var(--accent); font-weight: 500; }

.data-card-actions {
    margin-top: auto;
    padding: 10px 16px 14px;
    display: flex;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
}

.empty-state { text-align: center; padding: 48px 24px !important; }
.empty-state .empty-icon { font-size: 40px; opacity: 0.25; margin-bottom: 12px; }

.timeline-list { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { margin-bottom: 0 !important; }
.timeline-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.timeline-date { font-size: 11px; color: var(--text-muted); }
.timeline-meta { font-size: 11px; color: var(--text-muted); }

.filter-bar { margin-bottom: 16px; }
.filter-bar-inner { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 140px;
}

.filter-field span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.filter-field input,
.filter-field select {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

.form-grid { display: grid; gap: 12px; margin-bottom: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

.inline-form .form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

.inline-form .form-group input,
.inline-form .form-group select,
.inline-form .form-group textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-family: var(--font);
}

.form-advanced-block {
    margin: 12px 0 16px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.25);
}

.form-advanced-block summary { cursor: pointer; font-weight: 600; color: var(--accent); }

.form-submit-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.45);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(4, 30, 58, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.modal-overlay[hidden] { display: none !important; }
body.modal-open { overflow: hidden; }

.modal-panel { width: 100%; max-width: 520px; margin: auto; }
.modal-panel.modal-wide { max-width: 680px; }

.modal-titlebar { justify-content: space-between; }

.modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 10px;
}

@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
}

.theme-keygen .app-sidebar { background: rgba(0, 8, 0, 0.92); border-color: #0f0; }
.theme-keygen .sidebar-link { color: #0f0; font-family: 'Share Tech Mono', monospace; }
.theme-keygen .sidebar-link.active { background: rgba(0, 255, 0, 0.12); border-color: #0f0; color: #0f0; }
.theme-keygen .app-topbar { background: rgba(0, 8, 0, 0.85); border-color: #0a0; }
.theme-keygen .topbar-search input { background: #001800; border-color: #0a0; color: #0f0; }
