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

:root {
    --primary: #18A0A0;
    --primary-dark: #127976;
    --primary-glow: rgba(24,160,160,0.15);
    --role-admin: #18A0A0;
    --role-emp: #8b5cf6;
    --role-dent: #f59e0b;
    --bg: #0e1a1c;
    --bg2: #152326;
    --surface: #1a2f35;
    --surface2: #1f3840;
    --border: rgba(255,255,255,0.07);
    --text: #e2e8f0;
    --text-muted: #7a9aa0;
    --text-secondary: #94a3b8;
    --sidebar-w: 280px;
    --header-h: 56px;
    --radius: 12px;
    --radius-lg: 20px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* ===== LAYOUT ===== */
.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
}
.mobile-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}
.mobile-header-logo .accent { color: var(--primary); }
.mobile-menu-btn {
    background: var(--surface);
    border: none;
    color: var(--text);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: visible;
    z-index: 50;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 45;
    backdrop-filter: blur(4px);
}

.sidebar-header {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
    flex-shrink: 0;
}
.logo-name { font-weight: 800; font-size: 0.95rem; color: var(--text); line-height: 1; }
.logo-sub { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.back-btn {
    width: 32px; height: 32px;
    background: var(--surface);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}
.back-btn:hover { background: var(--surface2); color: var(--text); }
.back-btn .material-symbols-outlined { font-size: 18px; }

/* ===== SEARCH ===== */
.search-wrapper {
    position: relative;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: visible;
}
.search-icon {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--text-muted);
    pointer-events: none;
}
#search-input {
    width: 100%;
    padding: 0.55rem 2.5rem 0.55rem 2.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
#search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
#search-input::placeholder { color: var(--text-muted); }
.search-kbd {
    position: absolute;
    right: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.55rem;
    color: var(--text-muted);
    padding: 2px 5px;
    font-family: monospace;
}

.search-results {
    position: absolute;
    top: calc(100% - 12px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 500;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}
.search-results.hidden { display: none; }
.search-result-item {
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface2); }
.search-result-item .result-title { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.search-result-item .result-desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.search-result-item .result-role {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 2px;
}
.no-results { padding: 1rem; text-align: center; font-size: 0.8rem; color: var(--text-muted); }

/* ===== SIDEBAR NAV ===== */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}
.nav-group { margin-bottom: 1.5rem; }
.nav-group-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 0.5rem;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-group ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.18s;
    cursor: pointer;
}
.nav-link .material-symbols-outlined { font-size: 18px; flex-shrink: 0; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { background: var(--primary-glow); color: var(--primary); font-weight: 600; }
.nav-link.active .material-symbols-outlined { color: var(--primary); }

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-footer-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}
.sidebar-footer-link:hover { opacity: 0.8; }
.sidebar-footer-link .material-symbols-outlined { font-size: 16px; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    overflow-y: auto;
    height: 100vh;
    background: var(--bg);
}
.content-wrapper {
    max-width: 860px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
}

/* ===== PAGE HEADER ===== */
.page-hero {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}
.page-hero .role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}
.page-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 0.6rem;
}
.page-hero p {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.7;
}

/* ===== SECTION ===== */
.doc-section {
    margin-bottom: 2.5rem;
}
.doc-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.doc-section h2 .material-symbols-outlined { color: var(--primary); font-size: 22px; }
.doc-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.25rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* ===== FEATURE CARDS ===== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-card-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
}
.feature-card-icon .material-symbols-outlined { font-size: 20px; }
.feature-card h4 { font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 0.3rem; }
.feature-card p { font-size: 0.77rem; color: var(--text-muted); line-height: 1.5; }

/* ===== BUTTON DOCS ===== */
.btn-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.75rem; }
.btn-doc {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    transition: border-color 0.18s;
}
.btn-doc:hover { border-color: rgba(24,160,160,0.3); }
.btn-doc-icon {
    flex-shrink: 0;
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-doc-icon .material-symbols-outlined { font-size: 18px; color: var(--primary); }
.btn-doc-body { flex: 1; }
.btn-doc-body strong { font-size: 0.85rem; font-weight: 700; color: var(--text); display: block; margin-bottom: 2px; }
.btn-doc-body span { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; display: block; }

/* ===== CALLOUTS ===== */
.callout {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    border-left: 3px solid;
    font-size: 0.82rem;
    line-height: 1.6;
}
.callout .material-symbols-outlined { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.callout.tip { background: rgba(24,160,160,0.07); border-color: var(--primary); color: #a0d8d8; }
.callout.tip .material-symbols-outlined { color: var(--primary); }
.callout.warn { background: rgba(245,158,11,0.07); border-color: var(--role-dent); color: #fcd47a; }
.callout.warn .material-symbols-outlined { color: var(--role-dent); }
.callout.note { background: rgba(139,92,246,0.07); border-color: var(--role-emp); color: #c4b5fd; }
.callout.note .material-symbols-outlined { color: var(--role-emp); }

/* ===== STATUS FLOW ===== */
.status-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0.75rem 0;
}
.status-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}
.status-arrow { color: var(--text-muted); font-size: 16px; }

/* ===== ANIMATION ===== */
.content-wrapper { animation: fadeUp 0.3s ease; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== ROLE OVERRIDES ===== */
.role-admin { --role-color: var(--role-admin); }
.role-emp   { --role-color: var(--role-emp); }
.role-dent  { --role-color: var(--role-dent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body { overflow: auto; }
    .layout { flex-direction: column; height: auto; overflow: visible; }
    .mobile-header { display: flex; }
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        height: 100%;
        z-index: 60;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-content {
        height: auto;
        margin-top: var(--header-h);
        overflow: visible;
    }
    .content-wrapper { padding: 1.5rem 1rem 4rem; }
    .page-hero h1 { font-size: 1.5rem; }
    .feature-grid { grid-template-columns: 1fr; }
}
