/* Vērtēšanas sistēma — stils v0.3
   Sānu izvēlne + mierīga institucionāla palete (tumši zaļganzils akcents). */

:root {
  --accent:        #0e5f56;
  --accent-dark:   #0a4740;
  --accent-darker: #073530;
  --accent-soft:   #e3efed;
  --bg:            #f5f4f1;
  --surface:       #ffffff;
  --text:          #22302e;
  --text-muted:    #6b7573;
  --border:        #d9ddda;
  --error-bg:      #fbe9e7;
  --error-text:    #8c2f21;
  --success-bg:    #e6f3ec;
  --success-text:  #1c5c3c;
  --radius:        10px;
  --sidebar-w:     230px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

/* ===== Karkass: sānu izvēlne + saturs ===== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--accent-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.side-brand a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  display: block;
}
.side-org {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  font-size: 12px;
  background: rgba(255,255,255,0.14);
  border-radius: 6px;
}

.side-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.side-section {
  padding: 16px 18px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
}

.side-link {
  display: block;
  padding: 9px 18px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.side-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.side-link.active {
  background: var(--accent-darker);
  border-left-color: #7fd1c0;
  color: #fff;
  font-weight: 500;
}

.side-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.side-user { font-size: 13px; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout {
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
}
.side-logout:hover { background: rgba(255,255,255,0.12); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.page {
  width: 100%;
  max-width: 1100px;
  padding: 28px 28px 48px;
}

/* Mobilā josla un pārslēgs */
.mobilebar { display: none; }
.nav-toggle { display: none; }
.nav-overlay { display: none; }

@media (max-width: 800px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    height: 100%;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
  }
  .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  .nav-toggle:checked ~ .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 20;
  }
  .mobilebar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--accent-dark);
    color: #fff;
    padding: 0 16px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .nav-burger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 6px 2px;
  }
  .nav-burger span {
    width: 20px; height: 2px;
    background: #fff;
    border-radius: 2px;
  }
  .mobile-title { font-weight: 600; font-size: 15px; }
  .page { padding: 20px 16px 40px; }
}

/* ===== Pieteikšanās lapas (bez izvēlnes) ===== */
.centered {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; }
.auth-title { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.auth-sub   { margin: 0 0 24px; color: var(--text-muted); font-size: 15px; }
.auth-links { margin: 20px 0 0; font-size: 14px; text-align: center; }
.auth-links a { color: var(--accent); }

/* ===== Kartītes ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.card + .card { margin-top: 24px; }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 8px; }
.muted { color: var(--text-muted); font-size: 14px; }

.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 16px 0; }
.meta dt { font-weight: 600; font-size: 14px; }
.meta dd { margin: 0; font-size: 14px; }

/* ===== Formas ===== */
label {
  display: block;
  margin: 16px 0 6px;
  font-size: 14px;
  font-weight: 500;
}
label:first-of-type { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.code-input {
  text-align: center;
  font-size: 24px !important;
  letter-spacing: 0.4em;
  font-variant-numeric: tabular-nums;
}

.btn-primary {
  width: 100%;
  margin-top: 24px;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-top: 8px; }
.form-tight { margin-top: 16px; }
.fld { min-width: 140px; }
.fld.grow { flex: 1; min-width: 200px; }
.fld label { margin: 0 0 6px; }
.fld select { font-size: 15px; }
.fld-btn { display: flex; align-items: flex-end; gap: 8px; }
.btn-auto { width: auto; margin-top: 0; padding: 10px 20px; }
.checkbox-fld { display: flex; align-items: center; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; cursor: pointer; }
.checkbox-label input { width: auto; }

/* ===== Ziņojumi ===== */
.flash {
  padding: 12px 14px;
  border-radius: 8px;
  margin: 0 0 16px;
  font-size: 14px;
}
.flash-error   { background: var(--error-bg);   color: var(--error-text); }
.flash-success { background: var(--success-bg); color: var(--success-text); }

/* ===== Tabulas ===== */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr.inactive td { opacity: 0.5; }
.tbl tr.edit-row td { background: var(--accent-soft); }
.tbl .actions { white-space: nowrap; text-align: right; }

/* ===== Mazās pogas, inline formas ===== */
.inline-form { display: inline-block; margin: 0; }
.btn-small {
  display: inline-block;
  padding: 5px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.btn-small:hover { border-color: var(--accent); color: var(--accent); }
.btn-small.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-small.btn-accent:hover { background: var(--accent-dark); }
.btn-small.btn-accent:disabled { opacity: 0.6; cursor: default; }
.btn-link { border: none; background: none; color: var(--accent); }

.input-inline {
  padding: 5px 8px !important;
  font-size: 14px !important;
  width: auto !important;
  max-width: 240px;
}
.input-short { max-width: 120px; }

/* ===== Divas kolonnas ===== */
.two-col { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 1000px) {
  .two-col { grid-template-columns: 1fr 1fr; align-items: start; }
}

/* ===== Cilnes ===== */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 20px; }
.tab {
  padding: 7px 14px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.tab-count { opacity: 0.75; font-size: 12px; }

/* ===== Textarea un skaitļi ===== */
textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type="number"] {
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
.input-num { width: 72px !important; }
.input-num-wide { width: 90px; }
.crit-desc { margin-top: 2px; max-width: 480px; }
.checkbox-row { display: flex; padding: 6px 0; }
