/* ============================================================
   Konferencija — dizajn sustav
   ============================================================ */
:root {
  --brand:       #2456b7;
  --brand-dark:  #1b3f86;
  --brand-soft:  #eaf0fb;
  --ok:          #1f9d57;
  --ok-soft:     #e7f6ed;
  --warn:        #c98a14;
  --danger:      #d23b3b;
  --danger-soft: #fbeaea;
  --bg:          #f5f7fb;
  --surface:     #ffffff;
  --ink:         #1b2430;
  --muted:       #6b7585;
  --line:        #e6e9f2;
  --radius:      12px;
  --shadow:      0 1px 2px rgba(16,28,54,.06), 0 8px 24px rgba(16,28,54,.06);
  --shadow-sm:   0 1px 2px rgba(16,28,54,.08);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
small { color: var(--muted); }

/* ---------- Top navigation ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 50;
}
.topbar .inner {
  max-width: 1180px; margin: 0 auto; padding: 0 22px;
  height: 62px; display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 30px; width: auto; display: block; }
.brand .sep { width: 1px; height: 26px; background: var(--line); }
.brand .title { font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: .2px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.nav a.active { background: var(--brand); color: #fff; }
.spacer { flex: 1; }
.usermenu { display: flex; align-items: center; gap: 12px; }
.usermenu .who { text-align: right; line-height: 1.1; }
.usermenu .who b { font-size: 14px; }
.role-chip {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 20px; background: var(--brand-soft); color: var(--brand-dark);
  font-weight: 600;
}
.role-chip.superadmin { background: #efe7fb; color: #6b35c9; }
.role-chip.admin { background: var(--brand-soft); color: var(--brand-dark); }
.role-chip.editor { background: var(--ok-soft); color: var(--ok); }

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 26px auto; padding: 0 22px; min-height: calc(100vh - 200px); }
.appfoot {
  max-width: 1180px; margin: 30px auto 16px; padding: 12px 22px 0;
  border-top: 1px solid var(--line); display: flex; justify-content: space-between;
  align-items: center; gap: 12px; color: var(--muted); font-size: 12px;
}
.appfoot .ver { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.auth-ver { position: fixed; left: 0; right: 0; bottom: 14px; text-align: center; color: rgba(255,255,255,.7); font-size: 12px; margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.card h3 { font-size: 16px; }
.card + .card { margin-top: 16px; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .n { font-size: 30px; font-weight: 700; line-height: 1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat.ok .n { color: var(--ok); }
.stat.brand .n { color: var(--brand); }

/* ---------- Buttons ---------- */
.btn, button {
  cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; border-radius: 9px; padding: 9px 16px;
  background: var(--brand); color: #fff; display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; transition: background .15s, box-shadow .15s, transform .02s;
}
.btn:hover, button:hover { background: var(--brand-dark); }
.btn:active, button:active { transform: translateY(1px); }
.btn.ghost, button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover, button.ghost:hover { background: #f1f4fa; }
.btn.ok, button.ok { background: var(--ok); }
.btn.ok:hover, button.ok:hover { background: #178247; }
.btn.danger, button.danger { background: var(--danger); }
.btn.danger:hover, button.danger:hover { background: #b32f2f; }
.btn.sm, button.sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date], select, input:not([type]) {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; background: #fff; color: var(--ink); transition: border .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=file] { padding: 8px; background: #fff; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label.field { margin: 0; }

/* ---------- Search bar ---------- */
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.search { display: flex; gap: 8px; }
.search input { min-width: 280px; }

/* ---------- Tables ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #fafbfe; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
tr.in { background: var(--ok-soft); }
tr.in:hover { background: #ddf1e6; }
.rowact { display: flex; gap: 7px; align-items: center; }
.rowact form { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.name b { font-weight: 600; }

/* ---------- Pills / status ---------- */
.pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.wait { background: #f1f3f8; color: var(--muted); }
.pill.off { background: var(--danger-soft); color: var(--danger); }

/* ---------- Flash ---------- */
.flash-area { max-width: 1180px; margin: 16px auto 0; padding: 0 22px; }
.flash { background: #fff7e6; border: 1px solid #f0d999; color: #7a5b12; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-sm); }
.flash + .flash { margin-top: 8px; }

/* ---------- Collapsible ---------- */
details.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 16px; }
details.panel summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::before { content: "＋"; color: var(--brand); font-weight: 700; }
details.panel[open] summary::before { content: "－"; }
details.panel .body { padding: 0 18px 18px; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1b3f86 0%, #2456b7 55%, #3f78d6 100%); padding: 24px; }
.auth-card { background: #fff; width: 100%; max-width: 410px; border-radius: 16px; padding: 34px 32px;
  box-shadow: 0 20px 60px rgba(10,24,60,.35); }
.auth-card .logo { text-align: center; margin-bottom: 18px; }
.auth-card .logo img { height: 46px; }
.auth-card h1 { font-size: 21px; text-align: center; }
.auth-card .hint { text-align: center; color: var(--muted); margin: -4px 0 22px; font-size: 14px; }
.auth-card .flash { margin-bottom: 16px; }
.qr-box { text-align: center; }
.qr-box img { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.secret { font-family: ui-monospace, Consolas, monospace; background: #f1f4fa; padding: 8px 12px; border-radius: 8px; display: inline-block; letter-spacing: 1px; }

/* ---------- Conference cards grid ---------- */
.conf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.conf-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.conf-card h3 { font-size: 17px; margin: 0; }
.conf-card .meta { color: var(--muted); font-size: 13px; }
.conf-card .bar { height: 7px; background: var(--line); border-radius: 6px; overflow: hidden; }
.conf-card .bar > span { display: block; height: 100%; background: var(--ok); }
.conf-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

/* ---------- Hamburger + drawer ---------- */
.hamburger { background: transparent; border: none; padding: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; border-radius: 8px; }
.hamburger:hover { background: var(--brand-soft); }
.hamburger span { width: 22px; height: 2.5px; background: var(--ink); border-radius: 2px; display: block; }

.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 90;
  opacity: 0; visibility: hidden; transition: opacity .2s; }
.overlay.show { opacity: 1; visibility: visible; }

.drawer { position: fixed; top: 0; left: 0; height: 100%; width: 280px; background: var(--surface);
  box-shadow: 2px 0 24px rgba(15,23,42,.18); z-index: 100; transform: translateX(-100%);
  transition: transform .22s ease; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head img { height: 26px; }
.drawer-close { background: transparent; border: none; font-size: 26px; line-height: 1; color: var(--muted);
  cursor: pointer; padding: 0 6px; }
.drawer-close:hover { color: var(--ink); background: transparent; }
.drawer-user { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-user .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.drawer-nav { padding: 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.drawer-nav a { padding: 11px 14px; border-radius: 9px; color: var(--ink); font-weight: 500; font-size: 15px; }
.drawer-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.drawer-nav a.active { background: var(--brand); color: #fff; }
.drawer-foot { padding: 14px 16px; border-top: 1px solid var(--line); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 2px; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(31,157,87,.2); }
.dot.idle { background: #c8ccd6; }
code { background: #f1f4fa; padding: 2px 7px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

@media (max-width: 640px) {
  .topbar .inner { gap: 10px; padding: 0 12px; }
  .search input { min-width: 0; }
  .usermenu .who { display: none; }
}
