:root {
  --primary-50: #fcf3f4;
  --primary-100: #f9e5e8;
  --primary-500: #cc4f65;
  --primary-600: #ab3247;
  --primary-700: #8e2336;
  --ink-950: #101d2b;
  --ink-900: #182c40;
  --ink-800: #263a45;
  --ink-700: #3b5463;
  --muted: #807782;
  --line: #d7d2d6;
  --surface: #ffffff;
  --bg: #f8f8f9;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #92400e;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(16, 29, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink-900);
  background: var(--ink-950);
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

.topbar {
  min-height: 72px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--ink-900);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img,
.login-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  object-fit: cover;
  background: white;
}

.brand h1 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
  max-width: 290px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-kicker {
  margin: 0 0 2px;
  font-size: 0.72rem;
  color: #e7a9b4;
  font-weight: 700;
  letter-spacing: 0;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.09);
}

.content {
  padding: 16px 14px calc(96px + env(safe-area-inset-bottom));
}

.flash {
  margin: 12px 14px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success);
}

.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ── Login screen (standalone, no topbar) ── */

.login-body {
  background: var(--ink-950);
}

.login-screen {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--ink-950);
}

.login-hero-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(40px + env(safe-area-inset-top)) 24px 36px;
  min-height: 260px;
  gap: 12px;
}

.login-logo-ring {
  width: 100px;
  height: 100px;
  border-radius: 22px;
  background: white;
  padding: 6px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 20px 48px rgba(0,0,0,0.35);
}

.login-logo-ring img {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
  display: block;
}

.login-app-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(204, 79, 101, 0.18);
  color: #f4a8b7;
  border: 1px solid rgba(204, 79, 101, 0.28);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-app-badge .icon {
  width: 13px;
  height: 13px;
  opacity: 0.85;
}

.login-school-name {
  margin: 0;
  color: rgba(255,255,255,0.88);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  max-width: 300px;
}

.login-form-card {
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 28px 20px calc(32px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 48px rgba(0,0,0,0.22);
}

.login-card-title {
  margin: 0 0 5px;
  font-size: 1.45rem;
  color: var(--ink-950);
  font-weight: 800;
}

.login-card-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.88rem;
}

.login-ekys-note {
  margin: 20px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

/* legacy — kept for any other reference */
.login-hero {
  text-align: center;
  padding: 24px 10px 16px;
}

.login-logo {
  width: 82px;
  height: 82px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.login-hero h2,
.hello h2,
.page-heading h2,
.detail-head h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink-950);
}

.hello {
  padding: 6px 2px 14px;
}

.hello p,
.page-heading p,
.detail-head p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-heading {
  margin-bottom: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(16, 29, 43, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: var(--ink-800);
  font-size: 0.92rem;
}

input,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: white;
  color: var(--ink-950);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

input:focus,
textarea:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(171, 50, 71, 0.12);
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.primary-action,
.danger-action,
.secondary-button,
.outline-button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.primary-action {
  background: var(--primary-600);
  color: white;
  width: 100%;
}

.primary-action:active {
  background: var(--primary-700);
}

.danger-action {
  background: var(--danger);
  color: white;
  width: 100%;
}

.secondary-button {
  background: var(--ink-900);
  color: white;
  padding: 0 14px;
}

.outline-button {
  background: white;
  color: var(--ink-900);
  border: 1px solid var(--line);
  padding: 0 12px;
}

.link-action {
  margin-bottom: 14px;
}

.file-field {
  padding: 10px;
}

.file-summary,
.muted,
.empty-text,
.meta-line {
  color: var(--muted);
  font-size: 0.9rem;
}

.camera-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(16, 29, 43, 0.1);
  border-radius: var(--radius);
  background: #fbfbfc;
}

.camera-toolbar,
.capture-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.camera-toolbar .primary-action {
  width: auto;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #0b1220;
  aspect-ratio: 3 / 4;
}

.camera-stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.flip-camera-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.48);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s;
}

.flip-camera-btn:active {
  background: rgba(0, 0, 0, 0.7);
}

.recording-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
}

.camera-message {
  margin: 0;
  min-height: 18px;
  color: var(--success);
  font-size: 0.84rem;
  font-weight: 800;
}

.camera-message.error {
  color: var(--danger);
}

.native-capture-input {
  display: none;
}

.selected-media-list {
  display: grid;
  gap: 10px;
}

.selected-media-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(16, 29, 43, 0.1);
  border-radius: var(--radius);
  background: white;
}

.selected-media-preview {
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #0b1220;
}

.selected-media-preview img,
.selected-media-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.selected-media-info {
  min-width: 0;
}

.selected-media-info strong,
.selected-media-info span,
.selected-media-info small {
  display: block;
}

.selected-media-info strong {
  font-size: 0.88rem;
  color: var(--ink-950);
}

.selected-media-info span,
.selected-media-info small {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-media {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 900;
  padding: 0 10px;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.quick-card {
  min-height: 112px;
  border-radius: var(--radius);
  padding: 16px;
  background: white;
  border: 1px solid rgba(16, 29, 43, 0.08);
  box-shadow: var(--shadow);
  display: grid;
  align-content: space-between;
  font-weight: 800;
}

.quick-card.primary {
  background: var(--primary-600);
  color: white;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  background: white;
  border: 1px solid rgba(16, 29, 43, 0.08);
  border-radius: var(--radius);
  padding: 14px;
}

.metric span {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary-600);
}

.metric p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric.link {
  grid-column: 1 / -1;
}

.section-title,
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h3,
.media-section h3,
.panel h3 {
  margin: 0;
  font-size: 1rem;
}

.section-title a,
.section-title span {
  color: var(--primary-600);
  font-weight: 800;
  font-size: 0.85rem;
}

.card-list {
  display: grid;
  gap: 10px;
}

.report-card {
  background: white;
  border: 1px solid rgba(16, 29, 43, 0.08);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(16, 29, 43, 0.05);
}

.report-main {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.report-main strong {
  display: block;
  font-size: 0.96rem;
  color: var(--ink-950);
}

.report-main span,
.report-side small,
.student-row span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.report-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--primary-50);
  color: var(--primary-600);
  display: grid;
  place-items: center;
}

.report-side {
  display: grid;
  justify-items: end;
  align-content: space-between;
  gap: 8px;
  flex: none;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-approved {
  background: var(--success-bg);
  color: var(--success);
}

.status-rejected {
  background: var(--danger-bg);
  color: var(--danger);
}

.student-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.hidden {
  display: none;
}

.student-row {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.student-row img,
.avatar-fallback {
  width: 58px;
  height: 58px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--ink-900);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.student-row strong {
  display: block;
  color: var(--ink-950);
}

.not-found {
  color: var(--danger);
  font-weight: 800;
  margin: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 4px;
}

.tabs a {
  flex: none;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink-700);
  font-weight: 800;
  font-size: 0.86rem;
}

.tabs a.active {
  background: var(--ink-900);
  color: white;
  border-color: var(--ink-900);
}

.detail-head {
  margin-bottom: 14px;
}

.note-text {
  margin: 0;
  color: var(--ink-800);
  line-height: 1.55;
}

.media-section {
  margin-bottom: 14px;
}

.media-section h3 {
  margin-bottom: 10px;
}

.media-grid {
  display: grid;
  gap: 10px;
}

.media-item {
  margin: 0;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(16, 29, 43, 0.08);
}

.media-item img,
.media-item video {
  width: 100%;
  max-height: 360px;
  display: block;
  object-fit: contain;
  background: #0b1220;
}

.media-item figcaption {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.rejection {
  border-color: rgba(185, 28, 28, 0.25);
}

.bottom-nav {
  width: 100%;
  max-width: 480px;
  min-height: 66px;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(16, 29, 43, 0.1);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  box-shadow: 0 -8px 24px rgba(16, 29, 43, 0.08);
}

.nav-item {
  min-width: 0;
  min-height: 52px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.nav-item .icon {
  width: 19px;
  height: 19px;
}

.nav-item.active {
  color: var(--primary-600);
  background: var(--primary-50);
}

@media (max-width: 370px) {
  .content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand h1 {
    max-width: 230px;
  }

  .secondary-button {
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .nav-item {
    font-size: 0.62rem;
  }
}
