/* ==========================================================
   SwishJustice Portal
   Global Design System
   ========================================================== */

:root {
  --bg: #07111f;
  --bg-2: #0b1628;
  --bg-3: #101d31;

  --panel: #121f35;
  --panel-2: #17263f;
  --panel-3: #1d2f4d;

  --border: #2b3d5c;
  --border-soft: rgba(255,255,255,.08);

  --text: #f4f7fb;
  --text-soft: #c8d2e3;
  --muted: #8796ad;

  --primary: #0d6efd;
  --primary-dark: #084db3;
  --secondary: #2d3f5f;

  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;

  --radius: 12px;
  --radius-sm: 8px;

  --shadow: 0 12px 32px rgba(0,0,0,.35);

  --sidebar-width: 280px;
  --topbar-height: 72px;

  --transition: .2s ease;
}

/* ==========================================================
   Reset
   ========================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

/* ==========================================================
   Buttons
   ========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border: 0;
  border-radius: var(--radius-sm);

  padding: 12px 18px;

  font-weight: 700;
  line-height: 1;

  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover {
  background: #3b527a;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-inline {
  width: auto;
}

.btn-block {
  width: 100%;
}

/* ==========================================================
   Forms
   ========================================================== */

.form-group {
  display: block;
  margin-bottom: 20px;
}

.form-group span,
.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);

  background: var(--bg-2);
  color: var(--text);

  padding: 13px 14px;

  transition: var(--transition);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.2);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ==========================================================
   Alerts
   ========================================================== */

.alert {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}

.alert-error {
  background: rgba(220,53,69,.16);
  border: 1px solid rgba(220,53,69,.55);
  color: #ffd6dc;
}

.alert-success {
  background: rgba(25,135,84,.16);
  border: 1px solid rgba(25,135,84,.55);
  color: #d5f4e3;
}

.alert-warning {
  background: rgba(255,193,7,.14);
  border: 1px solid rgba(255,193,7,.55);
  color: #fff1bf;
}

/* ==========================================================
   Authentication Pages
   ========================================================== */

.auth-body {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    radial-gradient(circle at top left, rgba(13,110,253,.18), transparent 35%),
    linear-gradient(145deg, #06101e, #101d31);
}

.auth-page {
  width: 100%;
  max-width: 460px;
  padding: 40px 20px;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 38px;
}

.brand-mark {
  width: 70px;
  height: 70px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 18px;
  background: var(--primary);

  color: #fff;
  font-size: 28px;
  font-weight: 800;
}

.auth-brand h1 {
  font-size: 30px;
  margin-bottom: 4px;
}

.auth-brand p,
.form-header p,
.auth-help,
.auth-footer {
  color: var(--muted);
}

.form-header {
  margin-bottom: 28px;
}

.form-header h2 {
  margin-bottom: 8px;
}

.auth-help {
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
}

.auth-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 13px;
}

/* ==========================================================
   Application Shell
   ========================================================== */

.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;

  background: var(--bg-2);
  border-right: 1px solid var(--border-soft);

  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;

  overflow-y: auto;
  z-index: 50;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);

  background: rgba(11,22,40,.92);
  border-bottom: 1px solid var(--border-soft);

  position: sticky;
  top: 0;
  z-index: 40;

  backdrop-filter: blur(12px);
}

.content {
  padding: 32px;
}

/* ==========================================================
   Sidebar
   ========================================================== */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;

  padding: 24px;
  border-bottom: 1px solid var(--border-soft);
}

.sidebar-brand .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 20px;
}

.sidebar-brand h2 {
  font-size: 20px;
}

.sidebar-brand p {
  color: var(--muted);
  font-size: 13px;
}

.sidebar-nav {
  padding: 18px;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-title {
  margin: 0 0 8px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 12px 14px;
  border-radius: var(--radius-sm);

  color: var(--text-soft);
  font-weight: 600;

  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  background: var(--panel-2);
  color: var(--text);
}

.nav-icon {
  width: 22px;
  text-align: center;
  color: var(--muted);
}

/* ==========================================================
   Header / Topbar
   ========================================================== */

.topbar-inner {
  height: 100%;
  padding: 0 28px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.global-search {
  flex: 1;
  max-width: 620px;
}

.global-search input {
  background: var(--bg);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;

  background: var(--panel);
}

.user-avatar {
  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  background: var(--primary);

  color: #fff;
  font-weight: 800;
}

.user-meta strong {
  display: block;
  font-size: 14px;
}

.user-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* ==========================================================
   Page Headers
   ========================================================== */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;

  margin-bottom: 28px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-header h1 {
  font-size: 34px;
  line-height: 1.15;
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--text-soft);
}

.page-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================
   Cards / Panels
   ========================================================== */

.card,
.panel,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0,0,0,.16);
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-header h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.panel-header p {
  color: var(--muted);
  font-size: 14px;
}

.panel-header a {
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}

/* ==========================================================
   Dashboard
   ========================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.metric-card {
  padding: 20px;
}

.metric-label {
  display: block;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
}

.metric-card strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-bottom: 10px;
}

.metric-card small {
  color: var(--muted);
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
}

/* ==========================================================
   Lists / Timelines
   ========================================================== */

.list-panel {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.list-item h3 {
  font-size: 15px;
  margin-bottom: 5px;
}

.list-item p {
  color: var(--muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  border-left: 3px solid var(--primary);
  padding-left: 14px;
}

.timeline-item strong {
  display: block;
  margin-bottom: 4px;
}

.timeline-item span {
  color: var(--muted);
  font-size: 13px;
}

/* ==========================================================
   Quick Actions
   ========================================================== */

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-actions a {
  display: block;
  padding: 14px;
  border-radius: var(--radius-sm);

  background: var(--bg-2);
  border: 1px solid var(--border-soft);

  color: var(--text-soft);
  font-weight: 700;

  transition: var(--transition);
}

.quick-actions a:hover {
  background: var(--panel-3);
  color: var(--text);
}

/* ==========================================================
   Tables
   ========================================================== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--text-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--bg-2);
}

td {
  color: var(--text);
}

tr:hover td {
  background: rgba(255,255,255,.025);
}

/* ==========================================================
   Badges / Status
   ========================================================== */

.badge {
  display: inline-flex;
  align-items: center;

  border-radius: 999px;
  padding: 5px 10px;

  font-size: 12px;
  font-weight: 800;
}

.badge-open,
.badge-active,
.badge-success {
  background: rgba(25,135,84,.18);
  color: #94e2b5;
}

.badge-warning,
.badge-pending {
  background: rgba(255,193,7,.18);
  color: #ffe08a;
}

.badge-danger,
.badge-closed,
.badge-disabled {
  background: rgba(220,53,69,.18);
  color: #ff9aa7;
}

.badge-info {
  background: rgba(13,202,240,.18);
  color: #8beeff;
}

.badge-muted {
  background: rgba(135,150,173,.16);
  color: var(--text-soft);
}

/* ==========================================================
   Filters / Toolbars
   ========================================================== */

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;

  margin-bottom: 20px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;

  margin-bottom: 22px;
}

/* ==========================================================
   Modals
   ========================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;

  background: rgba(0,0,0,.65);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 720px;

  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);

  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-footer {
  border-bottom: 0;
  border-top: 1px solid var(--border-soft);

  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-body {
  padding: 24px;
}

/* ==========================================================
   Tabs
   ========================================================== */

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 22px;
}

.tab {
  padding: 12px 16px;
  border-bottom: 3px solid transparent;

  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* ==========================================================
   Detail Views
   ========================================================== */

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 22px;
}

.info-list {
  display: grid;
  gap: 12px;
}

.info-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;

  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.info-row span {
  color: var(--muted);
  font-weight: 700;
}

.info-row strong {
  font-weight: 600;
}

/* ==========================================================
   Pagination
   ========================================================== */

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;

  margin-top: 20px;
}

.page-btn {
  min-width: 38px;
  height: 38px;

  border: 1px solid var(--border);
  border-radius: var(--radius-sm);

  background: var(--panel);
  color: var(--text);

  font-weight: 700;
}

.page-btn.active,
.page-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================
   Utility Classes
   ========================================================== */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.text-muted { color: var(--muted); }
.text-soft { color: var(--text-soft); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 1300px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-columns,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
  }

  .content {
    padding: 22px;
  }

  .page-header,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-grid,
  .filter-grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    padding: 0 18px;
  }

  .global-search {
    display: none;
  }
}

@media (max-width: 600px) {
  .auth-card {
    padding: 28px;
  }

  .auth-brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 58px;
    height: 58px;
    font-size: 22px;
  }

  .auth-brand h1 {
    font-size: 24px;
  }

  .page-header h1 {
    font-size: 28px;
  }

  .content {
    padding: 16px;
  }
}