:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #68738a;
  --line: #dfe5ef;
  --primary: #1e5eff;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }
.narrow { max-width: 420px; margin: 10vh auto; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.06);
}

h1, h2, h3 { margin-top: 0; }
.muted { color: var(--muted); }

label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  background: white;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
button.secondary { background: #e8eefc; color: #173161; }

form { display: grid; gap: 14px; }
.grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }

header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 18px 24px;
  background: white;
  border-bottom: 1px solid var(--line);
}
header h1 { margin: 0; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.header-scope {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}
.header-scope .row {
  border: 0;
  background: transparent;
  padding: 0;
}
.header-scope .row strong {
  display: inline;
  margin: 0;
}
.header-assignments {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.header-assignments summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
}
.header-assignments .list {
  margin-top: 8px;
  max-width: 520px;
}
.header-assignments .row {
  padding: 8px;
  font-size: 13px;
}

main { max-width: 1180px; margin: 24px auto; padding: 0 16px; }
nav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
nav button { background: #e8eefc; color: #173161; }
nav button.active { background: var(--primary); color: white; }
.tab { display: none; }
.tab.active { display: block; }

#messages { margin-bottom: 12px; }
.message {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}
.message.error { border-color: #f3b7b0; color: var(--danger); }

.list { display: grid; gap: 8px; }
.list.compact { margin-top: 10px; }
.row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fbfcff;
}
.row strong { display: block; margin-bottom: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.space-between { justify-content: space-between; }
.subnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.subnav button {
  background: #e8eefc;
  color: #173161;
}
.subnav button.active {
  background: var(--primary);
  color: white;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 160px 120px auto;
  gap: 10px;
  align-items: end;
}
.numeric-summary {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.numeric-summary > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.dashboard-jankari-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fbfcff;
}
.dashboard-jankari-card h3,
.dashboard-jankari-card p {
  margin-bottom: 6px;
}
.dashboard-jankari-card > button {
  justify-self: start;
}
.dashboard-card-actions {
  margin-bottom: 0;
}
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}
.dashboard-stats > div {
  border-radius: 9px;
  padding: 9px;
  background: #eef3ff;
}
.dashboard-stats span,
.dashboard-stats strong {
  display: block;
}
.dashboard-stats span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
}
.dashboard-metric {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.ai-analysis {
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: white;
  line-height: 1.5;
}
.broadcast-nav.active {
  background: var(--primary);
  color: white;
}
.broadcast-message {
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 12px;
}
.response-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fbfcff;
}
.modal-panel {
  position: fixed;
  inset: 0;
  background: rgba(23, 32, 51, 0.45);
  padding: 24px;
  overflow: auto;
  z-index: 10;
}
.modal-panel > .card {
  max-width: 900px;
  margin: 5vh auto;
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e8eefc;
  color: #173161;
  font-size: 12px;
  font-weight: 700;
}
@media (max-width: 900px) {
  header {
    display: grid;
  }
  .header-actions {
    width: 100%;
    align-items: stretch;
  }
  .header-actions select {
    min-width: 0;
  }
}
@media (max-width: 760px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}
.pin-box {
  margin: 14px 0;
  padding: 12px;
  background: #fff8df;
  border: 1px solid #f1d06b;
  border-radius: 10px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
}
th {
  background: #f0f4ff;
  color: #173161;
}
td:last-child {
  letter-spacing: normal;
}
#bulkPinReport td:last-child {
  font-weight: 700;
  letter-spacing: 0.04em;
}
.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.table-actions button {
  padding: 7px 10px;
}

.period-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e0f0e8;
  color: #1a5c3a;
  font-size: 12px;
  font-weight: 700;
}

.frequency-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #f5e6d3;
  color: #6b4c1a;
  font-size: 12px;
  font-weight: 700;
}

.paused-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.period-selector {
  margin-bottom: 14px;
}

.period-selector label {
  display: flex;
  gap: 8px;
  align-items: center;
}

.period-selector select {
  min-width: 180px;
}

.storage-entry {
  border-left: 4px solid var(--muted);
}

.storage-size-badge {
  background: #fef3c7;
  color: #92400e;
}

.storage-file {
  font-size: 13px;
  padding: 2px 0;
  padding-left: 8px;
  border-left: 2px solid var(--line);
}

.storage-warning {
  margin: 0 0 12px 0;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: var(--danger);
  font-weight: 600;
  text-align: center;
}

.storage-warning a {
  color: var(--primary);
  text-decoration: underline;
}

.dashboard-recurring-card {
  border-left: 4px solid #e07b30;
}
.dashboard-cross-card {
  border-left: 4px solid #7c3aed;
}

.cross-department-badge { display: inline-block; border-radius: 999px; padding: 3px 8px; background: #ede9fe; color: #5b21b6; font-size: 12px; font-weight: 700; }

.cross-target-list label { display: flex; flex-direction: column; gap: 6px; }

.cross-target-department {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fbfcff;
}

.cross-target-department strong { display: block; margin-bottom: 6px; }

.cross-target-levels { display: flex; gap: 10px; flex-wrap: wrap; }
.cross-level-row { margin-bottom: 8px; }
.cross-users { margin-left: 24px; padding: 8px 0; }
.cross-users label { display: block; padding: 4px 0; }
.cross-selected-list { margin-top: 12px; }
.cross-selected-list p { font-weight: 600; }

.file2pc-selected { margin: 8px 0; }
.file2pc-selected-item { padding: 6px 10px; background: #f0f4ff; border-radius: 6px; margin-bottom: 4px; font-size: 14px; }
.file2pc-countdown { font-weight: 700; font-variant-numeric: tabular-nums; }
.file-download-link { color: var(--primary); text-decoration: underline; font-size: 13px; white-space: nowrap; cursor: pointer; }
.photo-modal-card { max-width: 700px; }
.photo-modal-card img { max-width: 100%; max-height: 70vh; border-radius: 8px; margin-top: 8px; }
