/* ReadySOC App — Stylesheet */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0f1f3d;
  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --blue-light: #eff6ff;
  --blue-mid:   #bfdbfe;
  --green:      #16a34a;
  --green-light:#f0fdf4;
  --amber:      #d97706;
  --amber-light:#fffbeb;
  --red:        #dc2626;
  --red-light:  #fef2f2;
  --gray-50:    #f8fafc;
  --gray-100:   #f3f4f6;
  --gray-200:   #e5e7eb;
  --gray-300:   #d1d5db;
  --gray-400:   #9ca3af;
  --gray-500:   #6b7280;
  --gray-600:   #4b5563;
  --gray-700:   #374151;
  --gray-900:   #111827;
  --sidebar-w:  220px;
  --radius:     8px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
}

html { font-size: 15px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--gray-50); color: var(--gray-900); line-height: 1.6; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ── Auth pages ───────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--gray-50); }
.auth-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; padding: 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-text { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: -0.4px; }
.auth-logo .logo-text span { color: var(--blue); }
.auth-card h1 { font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 6px; text-align: center; }
.auth-card p { font-size: 14px; color: var(--gray-500); text-align: center; margin-bottom: 28px; }
.auth-success { background: var(--green-light); border: 1px solid #bbf7d0; border-radius: var(--radius); padding: 16px; text-align: center; }
.auth-success h2 { font-size: 16px; font-weight: 700; color: #14532d; margin-bottom: 4px; }
.auth-success p { font-size: 13px; color: #166534; margin: 0; }
.auth-error { background: var(--red-light); border: 1px solid #fecaca; border-radius: var(--radius); padding: 12px 16px; font-size: 13px; color: #991b1b; margin-bottom: 16px; }

/* ── Form elements ────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; letter-spacing: .01em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-size: 14px; color: var(--gray-900);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.field textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--red); margin-top: 4px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 600; border: none; transition: all .15s; line-height: 1; }
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { border-color: var(--gray-400); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost     { background: none; color: var(--gray-500); border: none; padding: 6px 10px; }
.btn-ghost:hover { color: var(--gray-900); background: var(--gray-100); }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--navy); display: flex;
  flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 50;
}
.sidebar-logo { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.logo-link { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.logo-mark { width: 28px; height: 28px; background: #1d4ed8; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-text { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: -0.3px; }
.logo-text span { color: #60a5fa; }

.sidebar-company { padding: 14px 18px 12px; border-bottom: 1px solid rgba(255,255,255,.07); }
.company-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-plan { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; display: inline-block; padding: 2px 7px; border-radius: 10px; }
.plan-trial   { background: #451a03; color: #fb923c; }
.plan-starter { background: #1e3a5f; color: #93c5fd; }
.plan-growth  { background: #14532d; color: #4ade80; }
.plan-pro     { background: #4c1d95; color: #c4b5fd; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px; margin-bottom: 2px;
  font-size: 13px; font-weight: 500; color: #94a3b8;
  text-decoration: none; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #e2e8f0; text-decoration: none; }
.nav-item.active { background: rgba(37,99,235,.25); color: #fff; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 30px; height: 30px; background: #1d4ed8; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-details { flex: 1; overflow: hidden; }
.user-name  { font-size: 12px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 10px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { font-size: 16px; color: #64748b; text-decoration: none; padding: 4px; border-radius: 5px; transition: color .15s; }
.logout-btn:hover { color: #94a3b8; }

.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; max-width: calc(100% - var(--sidebar-w)); }

.trial-banner { background: #451a03; color: #fb923c; padding: 10px 32px; font-size: 13px; text-align: center; margin: -28px -32px 28px; }
.trial-banner a { color: #fed7aa; font-weight: 700; }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-title    { font-size: 20px; font-weight: 800; color: var(--navy); letter-spacing: -0.4px; }
.page-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.page-actions  { display: flex; gap: 8px; align-items: center; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; box-shadow: var(--shadow-sm); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; font-weight: 700; color: var(--gray-700); }
.card-body { padding: 20px; }

/* ── Stats ────────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; padding: 16px 18px; border-top: 3px solid; box-shadow: var(--shadow-sm); }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

/* ── Progress bars ────────────────────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }

/* ── Status pills ─────────────────────────────────────────────────────────── */
.status-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px; }
.status-implemented   { background: var(--green-light); color: var(--green); }
.status-in-progress   { background: var(--amber-light); color: var(--amber); }
.status-not-started   { background: var(--red-light); color: var(--red); }
.status-not-applicable{ background: var(--gray-100); color: var(--gray-500); }

/* ── Category tags ────────────────────────────────────────────────────────── */
.cat-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; color: #fff; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 14px; font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; text-align: left; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
.data-table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--gray-50); }

/* ── Controls list ────────────────────────────────────────────────────────── */
.controls-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.controls-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 180px); overflow-y: auto; padding-right: 4px; }
.control-item { background: #fff; border: 1.5px solid var(--gray-200); border-radius: 8px; padding: 11px 14px; cursor: pointer; transition: all .15s; }
.control-item:hover { border-color: var(--blue-mid); }
.control-item.active { border-color: var(--blue); background: var(--blue-light); }
.control-item-header { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.control-item-title { font-size: 12px; font-weight: 500; color: var(--gray-700); }
.control-detail { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; padding: 24px; box-shadow: var(--shadow-sm); }
.control-detail-header { border-bottom: 1px solid var(--gray-100); padding-bottom: 14px; margin-bottom: 18px; }
.control-detail-title { font-size: 16px; font-weight: 700; color: var(--gray-900); margin: 8px 0 4px; }
.control-detail-desc { font-size: 13px; color: var(--gray-500); line-height: 1.6; }

/* ── Evidence ─────────────────────────────────────────────────────────────── */
.evidence-list { display: flex; flex-direction: column; gap: 6px; }
.evidence-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--gray-50); border-radius: 7px; border: 1px solid var(--gray-100); }
.evidence-item-name { flex: 1; font-size: 13px; color: var(--gray-700); font-weight: 500; }
.evidence-item-meta { font-size: 11px; color: var(--gray-400); }
.evidence-upload { border: 1.5px dashed var(--gray-300); border-radius: 8px; padding: 20px; text-align: center; margin-top: 12px; transition: border-color .15s; }
.evidence-upload:hover { border-color: var(--blue); }
.evidence-upload p { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }

/* ── AI guidance ──────────────────────────────────────────────────────────── */
.ai-section { border-top: 1px solid var(--gray-100); padding-top: 16px; margin-top: 16px; }
.ai-response { background: #f0f9ff; border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; padding: 14px 16px; margin-top: 12px; font-size: 13px; color: var(--gray-700); line-height: 1.7; white-space: pre-wrap; }

/* ── Team ─────────────────────────────────────────────────────────────────── */
.member-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.member-row:last-child { border-bottom: none; }
.member-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-light); color: var(--blue-dark); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.member-info { flex: 1; }
.member-name  { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.member-email { font-size: 12px; color: var(--gray-500); }
.role-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.role-admin  { background: #ede9fe; color: #5b21b6; }
.role-member { background: var(--gray-100); color: var(--gray-600); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 28px; width: 100%; max-width: 480px; box-shadow: 0 20px 40px rgba(0,0,0,.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.modal-close { background: none; border: none; font-size: 20px; color: var(--gray-400); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--gray-700); }

/* ── Filters ──────────────────────────────────────────────────────────────── */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-select { font-size: 12px; padding: 6px 10px; border: 1px solid var(--gray-200); border-radius: 6px; background: #fff; color: var(--gray-700); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast-msg { background: var(--gray-900); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: all .25s; max-width: 320px; }
.toast-msg.show { opacity: 1; transform: translateY(0); }
.toast-msg.success { background: #14532d; }
.toast-msg.error   { background: #991b1b; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.empty-state p { font-size: 14px; margin-top: 8px; }
.divider { border: none; border-top: 1px solid var(--gray-100); margin: 20px 0; }
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }

@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-company, .nav-label, .user-details, .logo-text { display: none; }
  .main-content { margin-left: 60px; padding: 20px 16px; max-width: calc(100% - 60px); }
  .controls-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col-grid { grid-template-columns: 1fr; }
}
