/* =====================================================
   SureGRC — Application stylesheet
   Brand colors derived from KR Associates / SureGRC logo
   ===================================================== */

:root {
    --brand-navy:   #143075;
    --brand-navy-2: #1f3b8b;
    --brand-green:  #3aa326;
    --brand-green-2:#5fbf3f;

    --bg:          #f3f5fa;
    --surface:     #ffffff;
    --surface-2:   #f8fafc;
    --border:      #e2e8f0;
    --text:        #1f2937;
    --text-soft:   #4b5563;
    --muted:       #9ca3af;

    --danger:      #dc2626;
    --warning:     #d97706;
    --success:     #16a34a;
    --info:        #2563eb;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 6px rgba(15, 23, 42, .05), 0 10px 15px -3px rgba(15, 23, 42, .08);

    --radius: 10px;
    --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--brand-navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- Layout ----- */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: var(--brand-navy);
    color: #e5edff;
    display: flex;
    flex-direction: column;
}
.sidebar .brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar .brand img { width: 40px; height: 40px; }
.sidebar .brand .title { font-weight: 700; font-size: 16px; color: #fff; }
.sidebar .brand .subtitle { font-size: 11px; color: #b9c5ee; }

.nav { padding: 12px 8px; flex: 1; overflow-y: auto; }
.nav .nav-section { padding: 10px 12px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: #95a4d6; letter-spacing: .5px; }
.nav a.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: #d6deff; font-size: 13.5px;
    margin-bottom: 2px;
}
.nav a.nav-item:hover, .nav a.nav-item.active {
    background: rgba(255,255,255,.08); color: #fff; text-decoration: none;
}
.nav a.nav-item .ico { width: 18px; opacity: .8; text-align: center; font-size: 14px; }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 11.5px; color: #b9c5ee;
}

/* ----- Main area ----- */
.main { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--shadow-sm);
}
.topbar .page-title { font-size: 17px; font-weight: 600; color: var(--brand-navy); }
.topbar .user-chip {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-soft);
}
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-navy-2), var(--brand-green));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}

.content { padding: 22px 26px; flex: 1; }

/* ----- Cards / panels ----- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { margin: 0; font-size: 15.5px; color: var(--brand-navy); }
.card-body { padding: 18px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ----- Tiles (dashboard) ----- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tile {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.tile::before {
    content:''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--brand-green);
}
.tile .label { font-size: 12px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .4px; }
.tile .value { font-size: 26px; font-weight: 700; color: var(--brand-navy); margin: 6px 0 2px; }
.tile .delta { font-size: 12px; color: var(--text-soft); }
.tile.danger::before { background: var(--danger); }
.tile.warning::before { background: var(--warning); }
.tile.info::before { background: var(--info); }

/* ----- Buttons ----- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--radius-sm);
    border: 1px solid transparent; font-size: 13.5px; font-weight: 500;
    cursor: pointer; transition: all .15s ease; line-height: 1;
    background: #fff; color: var(--text);
}
.btn:hover { box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--brand-navy); color: #fff; border-color: var(--brand-navy); }
.btn-primary:hover { background: var(--brand-navy-2); color: #fff; text-decoration: none; }
.btn-success { background: var(--brand-green); color: #fff; border-color: var(--brand-green); }
.btn-success:hover { background: var(--brand-green-2); color: #fff; text-decoration: none; }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--brand-navy); color: var(--brand-navy); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 20px; font-size: 14.5px; }
.btn-ai { background: linear-gradient(135deg, var(--brand-navy-2), var(--brand-green)); color: #fff; border: none; }
.btn-ai:hover { color: #fff; opacity: .92; text-decoration: none; }

/* ----- Forms ----- */
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-group { margin-bottom: 14px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.form-control, select, textarea, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=file] {
    width: 100%; padding: 8px 11px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, select:focus, textarea:focus,
input:focus, textarea:focus {
    outline: none; border-color: var(--brand-navy);
    box-shadow: 0 0 0 3px rgba(20, 48, 117, .12);
}
textarea { min-height: 90px; resize: vertical; }
.form-help { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ----- Tables ----- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse;
    background: #fff; font-size: 13px;
}
table.data thead th {
    background: var(--surface-2);
    text-align: left;
    padding: 10px 14px; font-weight: 600;
    color: var(--text-soft); border-bottom: 1px solid var(--border);
    font-size: 12px; text-transform: uppercase; letter-spacing: .3px;
}
table.data tbody td {
    padding: 11px 14px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .actions { white-space: nowrap; }
table.data .actions a, table.data .actions form { margin-right: 6px; }

/* ----- Pills / Badges ----- */
.pill {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.4;
}
.pill-high     { background: #fee2e2; color: #b91c1c; }
.pill-medium   { background: #fef3c7; color: #92400e; }
.pill-low      { background: #d1fae5; color: #065f46; }
.pill-critical { background: #b91c1c; color: #fff; }
.pill-major    { background: #f97316; color: #fff; }
.pill-minor    { background: #6b7280; color: #fff; }
.pill-success  { background: #d1fae5; color: #065f46; }
.pill-pending  { background: #e0e7ff; color: #3730a3; }
.pill-open     { background: #fef3c7; color: #92400e; }
.pill-closed   { background: #d1fae5; color: #065f46; }
.pill-overdue  { background: #fee2e2; color: #b91c1c; }
.pill-draft    { background: #e5e7eb; color: #374151; }
.pill-final    { background: #064e3b; color: #d1fae5; }

/* ----- Alerts ----- */
.alert {
    padding: 11px 16px; border-radius: var(--radius-sm);
    margin-bottom: 14px; font-size: 13px;
    border-left: 4px solid;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #10b981; }
.alert-danger  { background: #fef2f2; color: #b91c1c; border-color: #ef4444; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #f59e0b; }
.alert-info    { background: #eff6ff; color: #1e3a8a; border-color: #3b82f6; }

/* ----- Login ----- */
.login-wrap {
    min-height: 100vh;
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--bg);
}
.login-hero {
    background: linear-gradient(135deg, var(--brand-navy) 0%, #0c1d50 100%);
    color: #fff;
    display: flex; flex-direction: column; justify-content: center; padding: 50px 60px;
}
.login-hero h1 { font-size: 30px; margin: 0 0 10px; font-weight: 700; }
.login-hero h1 span { color: var(--brand-green-2); }
.login-hero p { color: #c5d1f5; font-size: 15px; max-width: 420px; line-height: 1.6; }
.login-hero .features { margin-top: 30px; }
.login-hero .features li { color: #d6deff; margin-bottom: 8px; font-size: 14px; list-style: none; }
.login-hero .features li::before { content: '✓  '; color: var(--brand-green-2); font-weight: 700; }
.login-hero ul { padding: 0; }

.login-card { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card .box { width: 100%; max-width: 380px; }
.login-card h2 { margin: 0 0 6px; color: var(--brand-navy); font-size: 22px; }
.login-card .sub { color: var(--text-soft); margin-bottom: 22px; font-size: 13.5px; }
.login-card .brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-card .brand-row img { height: 44px; }
.login-card .firm { font-size: 13px; color: var(--text-soft); }
.login-card .firm strong { color: var(--brand-navy); }

@media (max-width: 900px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-hero { padding: 30px 24px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

/* ----- Misc ----- */
.actions-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.actions-bar .grow { flex: 1; }
.muted { color: var(--muted); }
.text-right { text-align: right; }
.empty-state { padding: 36px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 42px; margin-bottom: 8px; opacity: .4; }
.crumbs { font-size: 12.5px; color: var(--text-soft); margin-bottom: 12px; }
.crumbs a { color: var(--text-soft); }
.crumbs .sep { margin: 0 6px; opacity: .5; }

.section-title { font-size: 14px; font-weight: 600; color: var(--brand-navy); margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* OCER finding box */
.ocer-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 16px; }
.ocer-grid dt { font-weight: 600; color: var(--brand-navy); font-size: 13px; }
.ocer-grid dd { margin: 0; font-size: 13.5px; }

/* RCM table dense */
table.rcm { font-size: 11.5px; }
table.rcm thead th { font-size: 10.5px; padding: 8px 10px; }
table.rcm tbody td { padding: 8px 10px; }
table.rcm tbody td.wrap { max-width: 280px; }

.print-only { display: none; }
@media print {
    .sidebar, .topbar, .actions-bar, .btn { display: none !important; }
    .app-shell { grid-template-columns: 1fr; }
    .content { padding: 0; }
    .card { box-shadow: none; border: none; }
    .print-only { display: block; }
}

/* AI button shimmer */
.ai-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px; border-radius: 999px;
    background: linear-gradient(135deg, #1f3b8b22, #3aa32633);
    color: var(--brand-navy); font-size: 11px; font-weight: 600;
}
