:root {
  --bg: #f4f7fb;
  --bg-tint: #eaf0f9;
  --surface: #ffffff;
  --line: #e6ecf5;
  --text: #101828;
  --muted: #667085;
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --warn: #92640a;
  --warn-soft: #fffaeb;
  --warn-line: #f5e2ad;
  --error: #b42318;
  --error-soft: #fef3f2;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Muss allen display-Regeln vorgehen: Elemente mit display:flex/grid wuerden
   das hidden-Attribut sonst ueberstimmen und trotzdem sichtbar bleiben. Genau
   das ist in diesem Projekt schon zweimal passiert. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-tint) 100%);
  background-attachment: fixed;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Grundgerüst: feste Seitenleiste links, Inhalt rechts. */
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 18px;
  min-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.brand-dot { color: var(--accent); }

.pill {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 26px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.nav-item:hover { background: var(--bg); color: var(--text); }

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.nav-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.nav-item.is-active .nav-count { color: var(--accent); }

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.sidebar-user {
  color: var(--muted);
  word-break: break-all;
}

.sidebar-links {
  display: flex;
  gap: 12px;
}

.sidebar-links a {
  color: var(--muted);
  text-decoration: none;
}

.sidebar-links a:hover { color: var(--accent); }

.content { min-width: 0; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 2px 20px;
}

h1 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
}

p { margin: 0 0 14px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error-text { color: var(--error); }

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
}

.card:last-child { margin-bottom: 0; }

.card.narrow { max-width: 420px; }

.card.warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

.card.warn h2 { color: var(--warn); }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-head h2 { margin: 0; }

.notice {
  border: 1px solid #cddcfb;
  background: var(--accent-soft);
  color: #1a4ba8;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
}

.notice.bad {
  background: var(--error-soft);
  border-color: #fbd5d2;
  color: var(--error);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 380px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  color: var(--muted);
}

input[type="email"],
input[type="password"],
input[type="text"] {
  font: inherit;
  color: var(--text);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

button, .button {
  font: inherit;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button:hover, .button:hover { background: var(--bg); }

button.primary, .button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover, .button.primary:hover { background: #1d4ed8; }

button.danger {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

button.danger:hover { background: #97220f; }

button:disabled { opacity: 0.5; cursor: default; }

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
}

.link-btn:hover { background: none; text-decoration: underline; }

/* Eingebettet im Shopify-Adminbereich: Abmelden ergibt dort keinen Sinn, die
   Anmeldung stammt von Shopify. Als CSS-Regel statt nur per JavaScript, damit
   der Button auch dann verschwindet, wenn App Bridge haengt. */
html.embedded #logoutBtn { display: none; }

.confirm-box {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--warn-line);
  background: var(--warn-soft);
  border-radius: 10px;
}

.confirm-box p {
  margin: 0 0 10px;
  color: var(--warn);
}

.checkbox-label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input { margin: 0; }

.facts {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 16px;
  margin: 0 0 18px;
  font-size: 14px;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* Breite Tabellen scrollen in sich, statt die Seite zu sprengen. */
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12.5px;
  white-space: nowrap;
}

.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }
.table a { color: var(--accent); }

.table td:first-child,
.table th:first-child { width: 30px; }

.thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg);
  display: block;
}

ul { margin: 0; padding-left: 20px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 5px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 14px;
  }
  .sidebar {
    position: static;
    min-height: 0;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 18px;
  }
  .nav-item { width: auto; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: 8px; }
}
