/* AKSERC Dashboard — light overview layout (branded green/orange) */

:root {
  --bg: #f3f4f6;
  --bg-sidebar: #eceef2;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --green: #1b6b45;
  --green-soft: #e7f5ee;
  --orange: #e97c1c;
  --orange-soft: #fff3e8;
  --warn: #d97706;
  --danger: #dc2626;
  --success: #059669;
  --info: #2563eb;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 16px;
  --radius-sm: 12px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-brand strong {
  display: block;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.sidebar-brand span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 500;
  font-size: 0.9rem;
  transition: 0.15s ease;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover { background: rgba(255,255,255,0.65); color: var(--text); }

.nav-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
}

.sidebar-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-user strong { display: block; font-size: 0.8rem; }
.sidebar-user span { display: block; font-size: 0.72rem; color: var(--muted); }

/* Main */
.main-area { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem 1.75rem 0.75rem;
}

.topbar h1 {
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }

.menu-toggle {
  display: none;
  border: 0;
  background: var(--surface);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  min-width: 240px;
  box-shadow: var(--shadow);
}

.search-pill svg { width: 16px; height: 16px; color: var(--muted); }
.search-pill input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  color: var(--text);
}

.live-clock {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  white-space: nowrap;
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: var(--shadow);
}

.content {
  padding: 0.75rem 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.view { display: none; flex-direction: column; gap: 1.25rem; }
.view.active { display: flex; }

.muted { color: var(--muted); font-size: 0.85rem; }

/* Metric cards */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.metric-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.metric-card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card { padding: 1.1rem 1.15rem 0.75rem; }

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.metric-chip {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
}

.chip-new { background: #eff6ff; color: var(--info); }
.chip-warn { background: var(--orange-soft); color: var(--orange); }

.metric-value {
  font-family: var(--display);
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin: 0.35rem 0 0.5rem;
}

.txt-warn { color: var(--warn); }
.txt-danger { color: var(--danger); }

.metric-chart { height: 72px; }

/* Overview panels */
.overview-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 1rem;
}

.panel { padding: 1.15rem; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-head h3 {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.seg-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #eef0f3;
  margin-bottom: 1rem;
}

.seg-bar span { display: block; height: 100%; }

.breakdown-list, .mix-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.breakdown-list li, .mix-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.65rem;
  align-items: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.breakdown-meta, .mix-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.breakdown-meta strong, .mix-meta strong {
  font-size: 0.88rem;
  font-weight: 600;
}

.breakdown-meta span, .mix-meta span {
  font-size: 0.75rem;
  color: var(--muted);
}

.breakdown-value, .mix-value {
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
}

.mix-track {
  grid-column: 1 / -1;
  height: 6px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
}

.mix-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #2f9e68);
  border-radius: 999px;
}

.success-rate {
  font-family: var(--display);
  font-size: 2.6rem;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.progress-track {
  height: 10px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--orange));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.mini-stats div { text-align: center; }
.mini-stats span {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
}
.mini-stats label {
  font-size: 0.72rem;
  color: var(--muted);
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.chart-frame { height: 240px; }

/* Table */
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-head { padding: 1.15rem 1.15rem 0.85rem; margin-bottom: 0; }

.table-toolbar {
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filters-row select {
  border: 1px solid var(--border);
  background: #f9fafb;
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  min-width: 140px;
}

.table-responsive { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fafafa;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.data-table tbody tr:hover { background: #f8faf9; }

.empty-row {
  text-align: center !important;
  color: var(--muted);
  padding: 2rem !important;
  cursor: default !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
}

.badge-within, .badge-resolved, .badge-closed { background: #dcfce7; color: #166534; }
.badge-due, .badge-awaiting, .badge-review { background: #ffedd5; color: #9a3412; }
.badge-overdue { background: #fee2e2; color: #991b1b; }
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-assigned { background: #ede9fe; color: #5b21b6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-success { background: var(--success); color: #fff; }
.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  width: min(1100px, 100%);
  max-height: 92vh;
  overflow: hidden;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.modal-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal-header h2 { font-size: 1.25rem; margin-top: 0.15rem; }

.close-modal-btn {
  border: 0;
  background: transparent;
  font-size: 1.75rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  overflow: auto;
}

.modal-sidebar, .modal-main-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  background: #fff;
}

.modal-section-card h4 {
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.7rem;
}

.info-item label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.info-item span, .description-box {
  font-size: 0.9rem;
  color: var(--text);
}

.description-box {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  line-height: 1.45;
}

.category-indicator {
  display: inline-flex;
  background: var(--green-soft);
  color: var(--green);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.8rem;
  width: fit-content;
}

.evidence-link {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: #fff;
  color: var(--text);
}

.assignment-details {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.feedback-modal { z-index: 1100; }
.feedback-modal-content {
  width: min(380px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 1.75rem 1.5rem 1.35rem;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

.feedback-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
}

.feedback-modal.success .feedback-icon { background: #dcfce7; color: #166534; }
.feedback-modal.error .feedback-icon { background: #fee2e2; color: #991b1b; }

.feedback-modal-content h3 { margin-bottom: 0.4rem; }
.feedback-modal-content p { color: var(--muted); margin-bottom: 1.25rem; }
.feedback-modal-content .btn { min-width: 7rem; }

.refresh-btn.loading { opacity: 0.6; pointer-events: none; }

@media (max-width: 1100px) {
  .overview-grid, .charts-row, .metric-grid { grid-template-columns: 1fr; }
  .modal-body { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    width: min(280px, 85vw);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .search-pill { min-width: 0; width: 160px; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
}
