/* Exmet APEX konsool – ühine kujundus (sama keel mis moodulilehtedel) */
:root {
  --bg: #0c0e11;
  --surface: #14171c;
  --surface-2: #1a1e24;
  --surface-3: #222730;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e9ebee;
  --muted: #8a919b;
  --faint: #5c636d;
  --accent: #22b14c;
  --accent-soft: rgba(34, 177, 76, 0.13);
  --warn: #f2b33d;
  --warn-soft: rgba(242, 179, 61, 0.12);
  --danger: #ef5b5b;
  --danger-soft: rgba(239, 91, 91, 0.12);
  --radius: 14px;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", ui-monospace, monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(34, 177, 76, 0.07), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }

/* ---------- Päis ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(12, 14, 17, 0.78);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 16px 20px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; text-decoration: none; }
.brand img { height: 20px; width: auto; display: block; }
.brand-divider { width: 1px; height: 22px; background: var(--border-strong); }
.brand-title { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.brand-app { font-weight: 500; color: var(--muted); }
.brand-sep { margin: 0 9px; color: var(--faint); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.userbox strong { color: var(--text); font-weight: 600; }
.userbox a { text-decoration: none; color: var(--muted); }
.userbox a:hover { color: var(--text); }

main { max-width: 1100px; margin: 0 auto; padding: 32px 20px 80px; }
h1 { font-size: 26px; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.01em; }
.lead { color: var(--muted); margin: 0 0 28px; }

/* ---------- Avalehe moodulid ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px; min-height: 170px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; position: relative; overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.tile::after {
  content: ""; position: absolute; inset: auto -40px -60px auto; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 177, 76, 0.12), transparent 70%);
}
.tile:hover { border-color: rgba(34, 177, 76, 0.5); background: var(--surface-2); transform: translateY(-2px); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-icon {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.tile-icon svg { width: 22px; height: 22px; }
.tile-name { font-size: 18px; font-weight: 650; }
.tile-desc { color: var(--muted); font-size: 13.5px; margin-top: -8px; }
.tile-go { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--accent); }
.tile.is-admin .tile-icon { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.tile.is-admin .tile-go { color: var(--text); }

/* ---------- Kaardid, vormid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 24px; }
.auth-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(400px, 100%); padding: 32px 28px; }
.auth-card .logo { height: 22px; display: block; margin: 0 auto 6px; }
.auth-card .app-name { text-align: center; color: var(--muted); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 26px; }
.auth-card h1 { font-size: 20px; text-align: center; margin-bottom: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--faint); }
textarea {
  padding: 10px 12px; border-radius: 10px; resize: vertical; min-height: 44px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); font: inherit; font-size: 14px; font-family: var(--mono);
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint code { font-family: var(--mono); color: var(--muted); }
input[type=text], input[type=password] {
  height: 42px; padding: 0 12px; border-radius: 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); font: inherit; font-size: 15px;
}
input[type=text]:focus, input[type=password]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check small { color: var(--muted); display: block; font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06150b; }
.btn-primary:hover { background: #2cc85a; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-block { width: 100%; height: 44px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: #ff8b8b; border: 1px solid rgba(239, 91, 91, 0.3); }
.alert-ok { background: var(--accent-soft); color: #5fd883; border: 1px solid rgba(34, 177, 76, 0.3); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(242, 179, 61, 0.3); }

/* ---------- Tabel ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .btn { margin-left: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  font-weight: 600; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-inactive td { opacity: 0.5; }
.table .muted { color: var(--muted); font-size: 13px; }
.table .mono { font-family: var(--mono); font-size: 13px; }
.table a.row-link { text-decoration: none; font-weight: 600; }
.table a.row-link:hover { color: var(--accent); }
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--muted); margin: 2px 4px 2px 0; white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.off { background: var(--danger-soft); color: var(--danger); }
.table-wrap { overflow-x: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 22px 0 8px; }
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--text); }

@media (max-width: 760px) {
  .brand-divider, .brand-title { display: none; }
  main { padding: 22px 16px 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .userbox .who { display: none; }
}
