:root {
  --bg: #fafaf6;
  --surface: #ffffff;
  --border: #ebe7dd;
  --text: #1a1a1a;
  --text-body: #444;
  --text-muted: #888;
  --accent: #d96c2c;
  --accent-soft: #fff2e8;
  --green: #2a8a4a;
  --red: #c83a3a;
  --radius: 10px;
  --shadow: 0 2px 14px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', -apple-system, "Helvetica Neue", sans-serif;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }
.big { font-size: 1.4rem; font-weight: 600; margin: 4px 0; }
.big-mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 1.05rem; letter-spacing: 1px; }
code { font-family: "SF Mono", Menlo, Consolas, monospace; background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; color: var(--accent); font-size: 0.95em; }

.topnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topnav .brand { font-weight: 800; font-size: 1.1rem; color: var(--text); }
.topnav nav { display: flex; gap: 16px; align-items: center; }
.topnav nav a { color: var(--text-body); font-size: 0.95rem; }
.topnav .user-tag { color: var(--text-muted); font-size: 0.9rem; }
.btn-mini, .btn {
  display: inline-flex; align-items: center;
  background: var(--accent); color: white; border: 0; border-radius: 6px;
  padding: 8px 14px; font-weight: 600; cursor: pointer; font-size: 0.9rem;
  font-family: inherit;
}
.btn { padding: 12px 22px; font-size: 1rem; }
.btn-mini.btn-danger, button.btn-danger { background: var(--red); }
.btn-mini[disabled] { opacity: 0.5; cursor: not-allowed; }

main { padding: 32px 24px; max-width: 1100px; margin: 0 auto; }

.flashes { max-width: 800px; margin: 12px auto 0; padding: 0 24px; }
.flash {
  padding: 10px 14px; border-radius: 6px; margin: 0 0 8px;
  background: var(--surface); border-left: 4px solid var(--accent);
}
.flash-ok { border-color: var(--green); }
.flash-err { border-color: var(--red); }

/* Hero / public landing */
.hero { text-align: center; padding: 60px 0 30px; }
.hero-pill {
  display: inline-block; padding: 6px 14px; background: var(--accent-soft);
  color: var(--accent); border-radius: 20px; font-weight: 600;
  font-size: 0.85rem; letter-spacing: 1px; margin-bottom: 18px;
}
.hero h1 { font-size: 3rem; font-weight: 800; margin: 0 0 18px; }
.hero .lead { max-width: 580px; margin: 0 auto; color: var(--text-body); font-size: 1.15rem; }

.how { margin-top: 60px; }
.how h2, .features h2, .cta h2 { text-align: center; font-size: 1.6rem; margin: 0 0 30px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: white; font-weight: 700; margin-bottom: 10px;
}
.step h3 { margin: 0 0 6px; font-size: 1.05rem; }
.step p { margin: 0; color: var(--text-body); font-size: 0.92rem; }

.features { margin: 60px 0; max-width: 700px; margin-left: auto; margin-right: auto; }
.bullets { list-style: none; padding: 0; }
.bullets li {
  padding: 10px 0 10px 24px; position: relative;
  color: var(--text-body); border-bottom: 1px solid var(--border);
}
.bullets li::before {
  content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 700;
}
.bullets li:last-child { border: 0; }

.cta { text-align: center; padding: 30px 0 60px; }
.cta p { color: var(--text-muted); margin-bottom: 18px; }

/* Login */
.login-stage { max-width: 480px; margin: 40px auto; text-align: center; }
.login-stage h1 { font-size: 2rem; margin: 0 0 10px; }
.login-stage .lead { color: var(--text-body); margin: 0 0 28px; }
.qr-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.qr-card img { width: 240px; height: 240px; }
.qr-meta { text-align: center; }
.qr-meta .muted { font-size: 0.85rem; margin-bottom: 4px; }
.login-status {
  margin-top: 22px; padding: 12px; background: var(--accent-soft);
  border-radius: 6px; color: var(--accent); font-weight: 600;
}

/* Dashboard / Admin cards */
.dash, .admin { display: flex; flex-direction: column; gap: 18px; }
.dash h1, .admin h1 { margin: 0 0 4px; }
.crumbs { color: var(--text-muted); font-size: 0.9rem; }
.crumbs a { color: var(--text-muted); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; margin: 0 0 12px; }
.card h3 { font-size: 1rem; margin: 18px 0 8px; color: var(--text-body); }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; color: var(--text); text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-n { font-size: 2.2rem; font-weight: 800; color: var(--accent); }
.stat-l { font-size: 0.9rem; color: var(--text-muted); margin-top: 4px; }

.admin-nav {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0;
}
.admin-nav a {
  padding: 8px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 0.92rem;
}
.admin-nav a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table th, table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table th { color: var(--text-muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; }
table tr:last-child td { border-bottom: 0; }
table input[type=text], table input[type=tel], table input[type=number], table select {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px;
  font-family: inherit; font-size: 0.9rem; background: var(--bg);
}
.totals td { border-top: 2px solid var(--text); padding-top: 12px; }
.sms-body { white-space: pre-wrap; font-family: "SF Mono", Menlo, monospace; font-size: 0.85rem; }

/* Forms */
.row-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-form input, .row-form select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 0.95rem; background: white; flex: 1 1 140px;
}
.row-form-vert { display: flex; flex-direction: column; gap: 8px; }
.row-form-vert input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 600; }
.badge-pending { background: #fff3cf; color: #8a6500; }
.badge-approved { background: #d8f0d8; color: var(--green); }
.badge-denied { background: #f9d6d6; color: var(--red); }
.badge-returned { background: #e0e0e0; color: #555; }
.badge-cancelled { background: #e0e0e0; color: #555; }
.badge-in { background: #e6f3ff; color: #1f5fa3; }
.badge-out { background: #fff2e8; color: var(--accent); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline; margin: 0; }
.actions .btn-mini { white-space: nowrap; }

/* card-grid layout för admin-listor (cyklar, användare, hyror) */
.section-h2 {
  font-size: 1.2rem; margin: 28px 0 4px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px; margin-top: 14px;
}
.entity-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0; overflow: hidden;
}
.entity-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.entity-tag {
  background: var(--accent-soft); color: var(--accent);
  padding: 4px 10px; border-radius: 6px; font-weight: 700;
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.95rem;
}
.entity-tag-text { font-weight: 700; font-size: 1.05rem; }
.entity-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.entity-actions form { display: inline; margin: 0; }
/* dolda forms används för form-attribute-koppling */
.hidden-form { display: none; }

/* form-grid: 2-kolumns fältlayout i kort och i top-formulär */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
}
.form-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.85rem; color: var(--text-muted);
}
.form-grid label > span { font-weight: 600; }
.form-grid label.span-2 { grid-column: 1 / -1; }
.form-grid input[type=text], .form-grid input[type=tel],
.form-grid input[type=number], .form-grid select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: 0.95rem; background: white;
  color: var(--text);
  width: 100%; min-width: 0; max-width: 100%;
}
.form-grid .checkbox-row {
  flex-direction: row; align-items: center; gap: 8px;
  font-size: 0.92rem; color: var(--text-body);
}
.form-grid .checkbox-row input { width: 18px; height: 18px; }
.form-actions { display: flex; gap: 8px; }
.form-actions.span-2 { grid-column: 1 / -1; }

/* key/value-lista i hyrkort */
.kv {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 4px 12px; margin: 0; font-size: 0.92rem;
}
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--text); }

/* hint-text under formulär */
.hint {
  font-size: 0.88rem; color: var(--text-muted);
  margin: 12px 0 0; line-height: 1.4;
}
.hint code, .hint strong { color: var(--text-body); }

/* lite mer luft mellan kort på landing */
.features + .features { margin-top: 0; }

footer {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted); font-size: 0.85rem;
}
