:root {
  /* Suhba official palette (Assets repo): navy #0D3B70, gold #D9A24A,
     warm cream #F8F5F1, soft gray #D8D2CB, charcoal #333333, sage #8FA68E.
     Dark theme is the default; [data-theme='light'] flips to the light half
     of the palette. Theme choice follows the OS unless toggled. */
  --bg: #081d38;
  --bg-panel: #0c2f5b;
  --bg-cell: #113a6c;
  --line: #27538d;
  --text: #f8f5f1;
  --text-dim: #a9bad1;
  --gold: #d9a24a;
  --row-bg: rgba(255, 255, 255, 0.02);
  --placeholder: #68809f;

  --t-camps: #e0a458;
  --t-courses: #6fa8b5;
  --t-arabic: #c97a6e;
  --t-scouts: #93a24f;
  --t-oneday: #a08fc0;
  --t-handcraft: #d8be5c;
  --t-new: #8fa68e;

  --font-display: "Amiri", serif;
  --font-body: "IBM Plex Sans Arabic", sans-serif;
}
:root[data-theme="light"] {
  --bg: #f8f5f1;
  --bg-panel: #ffffff;
  --bg-cell: #f1ece4;
  --line: #d8d2cb;
  --text: #333333;
  --text-dim: #7a756c;
  /* Darker gold: #d9a24a fails contrast as text on white. */
  --gold: #a8781f;
  --row-bg: rgba(13, 59, 112, 0.04);
  --placeholder: #a49d92;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  padding: 28px 20px 60px;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
}

.header {
  position: relative;
  padding: 26px 26px 22px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 20px;
  overflow: hidden;
}
/* White suhba logo; sits at the far corner opposite the reading direction
   and stays clear of the toolbar. Hidden on narrow screens. */
.brand-logo {
  position: absolute;
  inset-block-start: 40px;
  inset-inline-end: 26px;
  width: 148px;
  height: auto;
}
@media (max-width: 760px) {
  .brand-logo {
    display: none;
  }
}
.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  color: var(--gold);
  margin: 0 0 8px;
}
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  margin: 0 0 6px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.toolbar button,
.toolbar select,
.panel button,
.panel input,
.panel select {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
.toolbar select,
.panel select,
.panel input {
  background: var(--bg-cell);
  border-style: solid;
  cursor: auto;
}
.toolbar select {
  cursor: pointer;
  min-width: 200px;
}
.toolbar button:hover,
.panel button:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.toolbar button.danger:hover {
  border-color: var(--t-arabic);
  color: var(--t-arabic);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 14px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
  align-items: center;
}
.legend b {
  color: var(--text);
  font-weight: 600;
}
.swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.push-end {
  margin-inline-start: auto;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.state-demo {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.state-demo .cellstate {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.vak-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.vak-list span b {
  color: var(--gold);
  font-weight: 600;
}
.vak-list .source {
  color: var(--placeholder);
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px 18px;
  margin-bottom: 16px;
}
.panel-title {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold);
}
.holiday-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.holiday-row .month {
  color: var(--text-dim);
  min-width: 70px;
}
.holiday-row button {
  padding: 2px 9px;
  border-style: solid;
}
.holiday-row button.push {
  margin-inline-start: auto;
}
.holiday-row button:hover {
  border-color: var(--gold);
  color: var(--gold);
}
#holidayForm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.holiday-label-input {
  flex: 1;
  min-width: 140px;
}

.board {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  overflow-x: auto;
}
.grid {
  display: grid;
  grid-template-columns: 210px repeat(12, minmax(66px, 1fr));
  gap: 5px;
  min-width: 1100px;
}
.corner {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: flex-end;
  padding-bottom: 4px;
}
.month-head {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 2px 8px;
  border-bottom: 1px solid var(--line);
}
.vak-label {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
}
.vak-chip {
  background: repeating-linear-gradient(
    135deg,
    rgba(217, 162, 74, 0.18) 0 6px,
    rgba(217, 162, 74, 0.05) 6px 12px
  );
  border: 1px dashed rgba(217, 162, 74, 0.55);
  border-radius: 6px;
  font-size: 10.5px;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3px 3px;
  line-height: 1.3;
  min-height: 32px;
}

.track-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--row-bg);
}
.track-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: 0 0 auto;
  border: none;
  padding: 0;
  cursor: pointer;
}
.track-name {
  font-size: 13.5px;
  font-weight: 500;
  outline: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  width: 100%;
  text-align: start;
}
.track-del,
.track-edit {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.track-label:hover .track-del,
.track-label:hover .track-edit,
.track-del:focus,
.track-edit:focus {
  opacity: 1;
}
.track-del:hover {
  color: var(--t-arabic);
}
.track-edit:hover {
  color: var(--gold);
}

.color-pop {
  position: absolute;
  inset-block-start: 100%;
  inset-inline-start: 0;
  z-index: 10;
  display: flex;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.color-pop button {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 0;
  cursor: pointer;
}
.color-pop button:hover {
  border-color: var(--text);
}

.cell {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-cell);
  cursor: pointer;
  transition:
    transform 0.08s ease,
    background 0.12s ease,
    border-color 0.12s ease;
}
.cell:hover {
  transform: translateY(-1px);
}
.cell:active {
  transform: translateY(0);
}

.notes-label {
  font-size: 10.5px;
  color: var(--text-dim);
  padding: 2px 8px 10px;
}
.notes-display {
  grid-column: 2 / span 12;
  border-bottom: 1px dashed var(--line);
  color: var(--text-dim);
  font-size: 12.5px;
  padding: 2px 4px 10px;
  text-align: start;
}

.addrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.addrow button {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
.addrow button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.status {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 8px;
  min-height: 14px;
}

.lang-switch {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 14px;
  display: flex;
  gap: 2px;
}
.lang-switch select,
.lang-switch button,
.lang-switch a {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--bg-cell);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  cursor: pointer;
}
.lang-switch a {
  text-decoration: none;
  align-self: center;
}
.lang-switch select:hover,
.lang-switch button:hover,
.lang-switch a:hover {
  color: var(--gold);
  border-color: var(--gold);
}

dialog {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  min-width: 340px;
  max-width: 92vw;
  font-family: var(--font-body);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.dialog-title {
  margin: 0 0 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--gold);
}
.dialog-message {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.7;
}
#dialogFields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#dialogFields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
#dialogFields input {
  background: var(--bg-cell);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 8px 10px;
  outline: none;
}
#dialogFields input:focus {
  border-color: var(--gold);
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.dialog-actions button {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
.dialog-actions button:hover {
  color: var(--text);
  border-color: var(--text-dim);
}
.dialog-actions button[type="submit"] {
  border-style: solid;
  border-color: var(--gold);
  color: var(--gold);
}
.dialog-actions button[type="submit"]:hover {
  background: rgba(217, 162, 74, 0.12);
}
.dialog-actions button[type="submit"].danger {
  border-color: var(--t-arabic);
  color: var(--t-arabic);
}
.dialog-actions button[type="submit"].danger:hover {
  background: rgba(201, 122, 110, 0.12);
}

.toast {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-start: 22px;
  z-index: 20;
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.login-wrap {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 34px;
  width: min(360px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-logo {
  width: 130px;
  align-self: center;
  margin-bottom: 6px;
}
.login-card h1 {
  font-size: 24px;
  text-align: center;
  margin: 0 0 6px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-dim);
}
#loginForm input {
  background: var(--bg-cell);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 11px;
  outline: none;
}
#loginForm input:focus {
  border-color: var(--gold);
}
#loginForm button {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  margin-top: 4px;
}
#loginForm button:hover {
  background: rgba(217, 162, 74, 0.12);
}
.login-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--t-arabic);
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.login-sso {
  font-family: var(--font-body);
  font-size: 14px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-cell);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.login-sso:hover {
  border-color: var(--gold);
}

.user-chip {
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 2px 6px;
  align-self: center;
}
body[data-mode="view"] .edit-only {
  display: none;
}
body[data-mode="view"] .track-name,
body[data-mode="view"] .notes-display,
body[data-mode="view"] .track-swatch {
  pointer-events: none;
}
body[data-mode="view"] .cell {
  cursor: default;
}
body[data-mode="view"] .cell:hover {
  transform: none;
}
#usersList .holiday-row .month {
  min-width: 140px;
}
#usersList select {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg-cell);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
}
#userForm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
#userForm input {
  flex: 1;
  min-width: 140px;
}
#userForm select {
  min-width: 110px;
}

.back-link {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
}
.back-link:hover {
  border-color: var(--gold);
  color: var(--gold);
}

body[data-mode="view"] .track-edit,
body[data-mode="view"] .track-del,
body[data-mode="view"] .color-pop {
  display: none;
}
