/* Motaro försäljningssystem – mörkt tema. Ändra --accent för att matcha loggan. */
:root {
  --bg: #0b0b0c;
  --panel: #151517;
  --panel-2: #1c1c1f;
  --line: #2a2a2e;
  --text: #ececee;
  --muted: #9a9aa2;
  --accent: #ffffff;
  --accent-ink: #0b0b0c;
  --focus: #5b8cff;
  --ok: #3fb97f;
  --warn: #e0a93b;
  --err: #e5534b;
  --radius: 10px;
  --side-w: 232px;
  --side-w-min: 64px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: var(--side-w); background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  transition: width .15s ease; z-index: 20;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; text-decoration: none; }
.side-brand img { max-height: 34px; max-width: 100%; }
.side-brand .mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.side-brand .word { font-weight: 800; letter-spacing: .14em; }
.side nav, .side-foot { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.side nav { flex: 1; overflow-y: auto; }
.side-foot { border-top: 1px solid var(--line); padding-bottom: 12px; }
.side a, .collapse-btn {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: var(--muted); white-space: nowrap; overflow: hidden;
  background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.side a:hover, .collapse-btn:hover { background: var(--panel-2); color: var(--text); }
.side a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.app.collapsed .side { width: var(--side-w-min); }
.app.collapsed .side span, .app.collapsed .side-brand .word { display: none; }
.app.collapsed .side-brand img { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: rgba(11,11,12,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; background: none; border: 0; color: var(--text); padding: 6px; cursor: pointer; }
.content { padding: 24px; max-width: 1200px; width: 100%; }

/* ---------- Snabbsök ---------- */
.search { position: relative; flex: 1; max-width: 620px; display: flex; align-items: center; }
.search > .ic { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding: 10px 12px 10px 40px; font-size: 16px; }
.results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.5);
  max-height: 70vh; overflow-y: auto; padding: 6px;
}
.result { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px; border-radius: 8px; }
.result.sel, .result:hover { background: var(--panel-2); }
.result .title { font-weight: 600; }
.result .sub { color: var(--muted); font-size: .85em; }
.result .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.result-empty { padding: 12px; color: var(--muted); }

/* ---------- Komponenter ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #3a3a40; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--err); }
.btn.sm { padding: 5px 10px; font-size: .85em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
input[type=checkbox] { width: auto; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .9em; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cards .card { margin: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78em; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: rgba(63,185,127,.35); }
.badge.warn { color: var(--warn); border-color: rgba(224,169,59,.35); }
.badge.err { color: var(--err); border-color: rgba(229,83,75,.35); }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.alert.ok { border-color: rgba(63,185,127,.45); }
.alert.err { border-color: rgba(229,83,75,.55); }
.alert.warn { border-color: rgba(224,169,59,.55); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .85em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .v { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .85em; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--text); }

.secret { font-family: ui-monospace, Menlo, monospace; color: var(--muted); }
.keybox { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; user-select: all; }

/* ---------- Inloggning ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; }
.brand-big { font-weight: 800; letter-spacing: .2em; font-size: 1.4rem; margin-bottom: 18px; }
.auth-logo { max-width: 180px; margin-bottom: 18px; }

/* ---------- Mobil / iPad ---------- */
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; width: var(--side-w) !important; }
  .app.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
  .app.collapsed .side span, .app.collapsed .side-brand .word { display: inline; }
  .collapse-btn { display: none; }
  .menu-btn { display: block; }
  .top { padding: 10px 16px; }
  .content { padding: 16px; }
}
