/* =====================================================================
   Grace Wings ERP - Core Stylesheet
   Design tokens: Dark Navy Sidebar (#0f172a), light sticky topbar
===================================================================== */

:root {
    --gw-navy: #0f172a;
    --gw-navy-soft: #1a2540;
    --gw-navy-border: #24304d;
    --gw-accent: #2563eb;
    --gw-accent-soft: #3b82f6;
    --gw-gold: #f59e0b;
    --gw-green: #16a34a;
    --gw-red: #dc2626;
    --gw-bg: #f4f6fb;
    --gw-card-border: #e6e9f2;
    --gw-text-muted: #6b7280;
    --gw-radius: 12px;
    --gw-sidebar-w: 264px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gw-bg);
    color: #1e293b;
    margin: 0;
}

a { text-decoration: none; }

.gw-wrapper { display: flex; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.gw-sidebar {
    width: var(--gw-sidebar-w);
    background: linear-gradient(180deg, var(--gw-navy) 0%, #101a30 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1030;
    transition: transform .25s ease;
    box-shadow: 2px 0 12px rgba(15, 23, 42, .15);
}

.gw-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.35rem 1.25rem;
    border-bottom: 1px solid var(--gw-navy-border);
}

.gw-brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--gw-accent), var(--gw-gold));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
    flex-shrink: 0;
}

.gw-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.gw-brand-name { font-weight: 800; font-size: 1.02rem; color: #fff; letter-spacing: .02em; }
.gw-brand-sub { font-size: .68rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .08em; }

.gw-nav { padding: 1rem .75rem; overflow-y: auto; flex: 1; }

.gw-nav-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .68rem .9rem;
    margin-bottom: .2rem;
    border-radius: 9px;
    color: #b6c2d9;
    font-size: .89rem;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}

.gw-nav-link i { width: 18px; text-align: center; font-size: .95rem; opacity: .9; }

.gw-nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.gw-nav-link.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .28), rgba(37, 99, 235, .05));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gw-accent-soft);
}

.gw-sidebar-footer {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--gw-navy-border);
}

.gw-version { font-size: .68rem; color: #64748b; margin-top: .6rem; }

.gw-sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 1020;
}

/* ---------------- Main / Topbar ---------------- */
.gw-main {
    margin-left: var(--gw-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gw-topbar {
    position: sticky;
    top: 0;
    z-index: 1010;
    background: #ffffff;
    border-bottom: 1px solid var(--gw-card-border);
    padding: .85rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}

.gw-page-title { font-size: 1.15rem; font-weight: 700; color: #0f172a; }

.gw-burger {
    border: 1px solid var(--gw-card-border);
    background: #fff;
    border-radius: 8px;
    width: 38px; height: 38px;
}

.gw-avatar-btn { border: none; background: transparent; padding: 0; }
.gw-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gw-accent), var(--gw-navy));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: .95rem;
}

.gw-content { padding: 1.75rem; flex: 1; }

.gw-footer {
    padding: 1rem 1.75rem;
    font-size: .78rem;
    color: var(--gw-text-muted);
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--gw-card-border);
    background: #fff;
}

/* ---------------- Metric Cards ---------------- */
.gw-metric-card {
    background: #fff;
    border: 1px solid var(--gw-card-border);
    border-radius: var(--gw-radius);
    padding: 1.25rem 1.4rem;
    height: 100%;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    position: relative;
    overflow: hidden;
}

.gw-metric-icon {
    width: 46px; height: 46px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    margin-bottom: .9rem;
}

.gw-metric-label {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--gw-text-muted);
    font-weight: 600;
    margin-bottom: .25rem;
}

.gw-metric-value { font-size: 1.55rem; font-weight: 800; color: #0f172a; }
.gw-metric-sub { font-size: .78rem; color: var(--gw-text-muted); margin-top: .3rem; }

.bg-icon-blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.bg-icon-green  { background: linear-gradient(135deg, #16a34a, #15803d); }
.bg-icon-gold   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-icon-red    { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.bg-icon-navy   { background: linear-gradient(135deg, #1e293b, #0f172a); }
.bg-icon-purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }

/* ---------------- Cards / Panels ---------------- */
.gw-card {
    background: #fff;
    border: 1px solid var(--gw-card-border);
    border-radius: var(--gw-radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.gw-card-header {
    padding: 1.05rem 1.35rem;
    border-bottom: 1px solid var(--gw-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .6rem;
}

.gw-card-header h5, .gw-card-header h6 { margin: 0; font-weight: 700; color: #0f172a; }
.gw-card-body { padding: 1.35rem; }

/* ---------------- Tables ---------------- */
.gw-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    border-bottom: 1px solid var(--gw-card-border);
    white-space: nowrap;
    padding: .75rem 1rem;
}

.gw-table tbody td {
    padding: .75rem 1rem;
    font-size: .87rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f4f9;
}

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

.gw-badge { font-weight: 600; font-size: .72rem; padding: .32em .65em; border-radius: 6px; }

/* ---------------- Forms ---------------- */
.form-label { font-weight: 600; font-size: .84rem; color: #334155; }
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dbe1ea;
    font-size: .89rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--gw-accent-soft);
    box-shadow: 0 0 0 .18rem rgba(37, 99, 235, .15);
}

.btn-gw-primary {
    background: var(--gw-navy);
    border-color: var(--gw-navy);
    color: #fff;
    font-weight: 600;
    font-size: .88rem;
}
.btn-gw-primary:hover { background: #1e293b; border-color: #1e293b; color: #fff; }

.btn-gw-accent {
    background: var(--gw-accent);
    border-color: var(--gw-accent);
    color: #fff;
    font-weight: 600;
    font-size: .88rem;
}
.btn-gw-accent:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

/* ---------------- Login Page ---------------- */
.gw-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #1e293b, var(--gw-navy) 60%);
    padding: 1.5rem;
}

.gw-login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, .97);
    border-radius: 18px;
    padding: 2.4rem 2.1rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, .35);
    backdrop-filter: blur(6px);
}

.gw-login-logo {
    width: 58px; height: 58px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--gw-accent), var(--gw-gold));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.5rem;
    margin: 0 auto 1rem;
}

/* ---------------- Utility ---------------- */
.gw-scroll-x { overflow-x: auto; }
.text-navy { color: var(--gw-navy); }
.fw-800 { font-weight: 800; }

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .gw-sidebar { transform: translateX(-100%); }
    .gw-sidebar.show { transform: translateX(0); }
    .gw-main { margin-left: 0; }
    .gw-sidebar-backdrop.show { display: block; }
}
