/* Sign-in screen, user menu and notices. Colours come from the app's own
   theme variables (index CSS), so light and dark mode follow the app. */

.ks-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(var(--bg));
  color: rgb(var(--ink));
  overflow: auto;
}

.ks-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  border: 1px solid rgb(var(--line));
  border-radius: 12px;
  background: rgb(var(--surface));
  box-shadow: 0 8px 30px rgb(16 20 28 / 0.08);
}

.ks-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.ks-logo {
  width: 40px;
  height: 40px;
}

/* The company wordmark is dark artwork, so it keeps a white plate in dark mode. */
.ks-wordmark {
  display: block;
  width: 150px;
  margin: 22px auto 0;
  padding: 6px 10px;
  border-radius: 6px;
  background: #fff;
}

.ks-title {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.2;
}

.ks-subtitle {
  font-size: 12px;
  color: rgb(var(--ink-3));
}

.ks-heading {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 650;
}

.ks-note {
  margin: 0 0 16px;
  font-size: 13px;
  color: rgb(var(--ink-2));
}

.ks-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ks-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 550;
  color: rgb(var(--ink-2));
}

.ks-input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid rgb(var(--line-strong));
  border-radius: 8px;
  background: rgb(var(--surface));
  color: rgb(var(--ink));
  font: inherit;
  font-size: 14px;
}

.ks-input:focus-visible,
.ks-button:focus-visible,
.ks-link:focus-visible,
.ks-chip:focus-visible,
.ks-menu-item:focus-visible {
  outline: 2px solid rgb(var(--accent));
  outline-offset: 2px;
}

.ks-error {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: rgb(var(--bad));
}

.ks-button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: rgb(var(--accent));
  color: rgb(var(--accent-ink));
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.ks-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.ks-link {
  align-self: center;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: rgb(var(--ink-2));
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.ks-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- user chip ------------------------------------------------------------ */

/* The app has a bottom tab bar below 1024px and a 232px sidebar above it.
   The chip sits just above the tab bar, or in the sidebar above the app's
   own "Διακομιστής" badge. */

.ks-user {
  position: fixed;
  left: 12px;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 9000;
}

.ks-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 208px;
  height: 36px;
  padding: 0 3px;
  border: 1px solid rgb(var(--line-strong));
  border-radius: 999px;
  background: rgb(var(--surface));
  color: rgb(var(--ink));
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgb(16 20 28 / 0.12);
  cursor: pointer;
}

.ks-chip-initials {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgb(var(--accent-soft));
  color: rgb(var(--accent));
  font-size: 11px;
  font-weight: 700;
}

.ks-chip-name {
  display: none;
  overflow: hidden;
  padding-right: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1024px) {
  .ks-user {
    bottom: 62px;
  }

  .ks-chip {
    box-shadow: none;
  }

  .ks-chip-name {
    display: block;
  }
}

@media print {
  .ks-user,
  .ks-readonly,
  .ks-toasts {
    display: none;
  }
}

.ks-menu {
  position: absolute;
  left: 0;
  bottom: 44px;
  min-width: 230px;
  padding: 6px;
  border: 1px solid rgb(var(--line));
  border-radius: 10px;
  background: rgb(var(--surface));
  color: rgb(var(--ink));
  box-shadow: 0 10px 30px rgb(16 20 28 / 0.16);
}

.ks-menu[hidden] {
  display: none;
}

.ks-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgb(var(--line));
  font-size: 12px;
  color: rgb(var(--ink-3));
}

.ks-menu-head strong {
  font-size: 13px;
  color: rgb(var(--ink));
}

.ks-role {
  align-self: flex-start;
  margin-top: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgb(var(--accent-soft));
  color: rgb(var(--accent));
  font-weight: 600;
}

.ks-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: rgb(var(--ink));
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ks-menu-item:hover {
  background: rgb(var(--surface-2));
}

/* --- notices -------------------------------------------------------------- */

/* Phone layout: to the right of the user chip. Desktop: bottom centre. */
.ks-readonly {
  position: fixed;
  left: 58px;
  right: 12px;
  bottom: calc(71px + env(safe-area-inset-bottom, 0px));
  z-index: 8900;
  width: fit-content;
  max-width: calc(100vw - 70px);
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 5px 12px;
  border: 1px solid rgb(var(--warn) / 0.4);
  border-radius: 999px;
  background: rgb(var(--warn-soft));
  color: rgb(var(--warn));
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

@media (min-width: 1024px) {
  .ks-readonly {
    left: 50%;
    right: auto;
    bottom: 12px;
    transform: translateX(-50%);
  }
}

.ks-toasts {
  position: fixed;
  right: 12px;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 24px));
}

.ks-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgb(var(--line-strong));
  border-radius: 10px;
  background: rgb(var(--surface));
  color: rgb(var(--ink));
  font-size: 13px;
  box-shadow: 0 10px 30px rgb(16 20 28 / 0.16);
}

.ks-toast > span {
  flex: 1;
}

.ks-toast-action {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: rgb(var(--accent));
  color: rgb(var(--accent-ink));
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.ks-toast-close {
  border: 0;
  background: none;
  color: rgb(var(--ink-3));
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* --- admin page ----------------------------------------------------------- */

.ks-admin {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  color: rgb(var(--ink));
}

.ks-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.ks-admin-head h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 650;
}

.ks-admin-head .ks-note {
  max-width: 62ch;
}

.ks-admin-head .ks-link {
  flex: none;
}

.ks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
}

.ks-count {
  font-size: 13px;
  color: rgb(var(--ink-3));
}

.ks-table-wrap {
  overflow-x: auto;
  border: 1px solid rgb(var(--line));
  border-radius: 10px;
  background: rgb(var(--surface));
}

.ks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ks-table th {
  padding: 9px 12px;
  border-bottom: 1px solid rgb(var(--line));
  color: rgb(var(--ink-3));
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.ks-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgb(var(--line));
  vertical-align: middle;
}

.ks-table tr:last-child td {
  border-bottom: 0;
}

.ks-row-off td {
  color: rgb(var(--ink-3));
}

.ks-num {
  font-variant-numeric: tabular-nums;
}

.ks-you {
  color: rgb(var(--ink-3));
}

.ks-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ks-small {
  padding: 4px 9px;
  border: 1px solid rgb(var(--line-strong));
  border-radius: 6px;
  background: rgb(var(--surface));
  color: rgb(var(--ink));
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.ks-small:hover {
  background: rgb(var(--surface-2));
}

.ks-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.ks-tag-ok {
  background: rgb(var(--ok-soft));
  color: rgb(var(--ok));
}

.ks-tag-warn {
  background: rgb(var(--warn-soft));
  color: rgb(var(--warn));
}

.ks-tag-off {
  background: rgb(var(--surface-3));
  color: rgb(var(--ink-3));
}

.ks-dialog {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 22px;
  border: 1px solid rgb(var(--line));
  border-radius: 12px;
  background: rgb(var(--surface));
  color: rgb(var(--ink));
  box-shadow: 0 20px 60px rgb(16 20 28 / 0.25);
}

.ks-dialog-wide {
  width: min(620px, calc(100vw - 24px));
}

.ks-dialog::backdrop {
  background: rgb(16 20 28 / 0.45);
}

.ks-dialog h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.ks-actions-end {
  justify-content: flex-end;
}

.ks-hint {
  font-weight: 400;
  color: rgb(var(--ink-3));
}

.ks-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ks-inline .ks-input {
  flex: 1;
  min-width: 0;
}

.ks-mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 13px;
}

.ks-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.ks-check[hidden] {
  display: none;
}

.ks-check input {
  flex: none;
  margin-top: 3px;
}

.ks-check small {
  color: rgb(var(--ink-3));
}

.ks-checklist {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 44dvh;
  padding: 10px;
  overflow-y: auto;
  border: 1px solid rgb(var(--line));
  border-radius: 8px;
}

/* --- import of the school register from Excel ------------------------------ */

.ks-small-tall {
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
}

.ks-tag-bad {
  background: rgb(var(--bad) / 0.12);
  color: rgb(var(--bad));
}

.ks-dialog-import {
  width: min(980px, calc(100vw - 24px));
}

.ks-import {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.ks-import .ks-note {
  margin: 0;
}

.ks-file {
  height: auto;
  padding: 8px 11px;
}

.ks-import-box {
  padding: 10px 12px;
  border: 1px solid rgb(var(--line));
  border-radius: 8px;
  background: rgb(var(--surface-2));
  font-size: 13px;
}

.ks-import-box ul,
.ks-import-facts,
.ks-import-facts ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.ks-import-bad {
  border-color: rgb(var(--bad) / 0.4);
  color: rgb(var(--bad));
}

.ks-import-warn {
  border-color: rgb(var(--warn) / 0.4);
  background: rgb(var(--warn-soft));
  color: rgb(var(--warn));
}

.ks-import-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ks-import-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ks-import-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.ks-import-phase {
  width: auto;
  height: 32px;
}

.ks-import-section .ks-checklist {
  max-height: 24dvh;
}

.ks-import-list {
  max-height: 38dvh;
  overflow-y: auto;
  border: 1px solid rgb(var(--line));
  border-radius: 8px;
}

.ks-import-school {
  padding: 8px 10px;
  border-bottom: 1px solid rgb(var(--line));
}

.ks-import-school:last-child {
  border-bottom: 0;
}

.ks-import-school-name {
  margin-bottom: 4px;
  font-size: 13px;
}

.ks-import-school-name small {
  color: rgb(var(--ink-3));
}

.ks-import-change {
  display: grid;
  grid-template-columns: 18px minmax(120px, 190px) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  cursor: pointer;
}

.ks-import-field {
  color: rgb(var(--ink-2));
}

.ks-import-values {
  overflow-wrap: anywhere;
}

.ks-import-before {
  color: rgb(var(--ink-3));
  text-decoration: line-through;
}

.ks-import-facts {
  margin: 0;
  font-size: 13px;
  color: rgb(var(--ink-2));
}

.ks-import-facts summary {
  cursor: pointer;
}

.ks-import-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 640px) {
  .ks-import-change {
    grid-template-columns: 18px 1fr;
  }

  .ks-import-change > :nth-child(n + 3) {
    grid-column: 2;
  }
}

.ks-audit {
  margin-top: 28px;
}

.ks-audit summary {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: rgb(var(--ink-2));
  cursor: pointer;
}
