/* Tirzing — app styles */
:root {
  --plum: #6d3f7a;
  --plum-dark: #4f2c59;
  --plum-light: #8b5a99;
  --teal: #19b39a;
  --bg: #f4f4f6;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 15px;
}
a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
small, .muted { color: var(--muted); }
.text-good { color: var(--good); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--plum-dark); color: #fff; padding: 1rem .75rem;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0; overflow-y: auto;
}
.sidebar .brand { font-weight: 800; font-size: 1.3rem; color: #fff; padding: .5rem .75rem 1rem; display: block; }
.sidebar nav a {
  display: flex; align-items: center; gap: .6rem; color: #e8dcef; padding: .6rem .75rem;
  border-radius: 10px; margin-bottom: 2px; font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.sidebar nav a.active { background: var(--plum); color: #fff; }
.sidebar .nav-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #b794c4; padding: 1rem .75rem .35rem; }
.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line); padding: .75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
}
.content { padding: 1.5rem; max-width: 1100px; margin: 0 auto; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card.tight { padding: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s; z-index: 50; }
  .sidebar.open { left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Stat tiles */
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.stat .label { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; }
.stat .value { font-size: 1.5rem; font-weight: 800; margin-top: .25rem; }
.stat .value.sm { font-size: 1.15rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  background: var(--plum); color: #fff; border: none; border-radius: 999px;
  padding: .6rem 1.2rem; font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--plum-dark); text-decoration: none; }
.btn.block { width: 100%; }
.btn.secondary { background: #fff; color: var(--plum); border: 1px solid var(--line); }
.btn.secondary:hover { background: #faf7fc; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.danger { background: var(--bad); }
.btn.sm { padding: .35rem .8rem; font-size: .85rem; }
.btn.teal { background: var(--teal); }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin: .9rem 0 .35rem; }
label .opt { font-weight: 400; color: var(--muted); font-size: .8rem; margin-left: .35rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px;
  font-size: .95rem; font-family: inherit; background: #fbfbfc; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--plum-light); box-shadow: 0 0 0 3px rgba(139,90,153,.15); background: #fff; }
textarea { resize: vertical; min-height: 80px; }
.field-row { display: flex; gap: 1rem; }
.field-row > div { flex: 1; }
.inline-group { display: flex; gap: .5rem; }
.inline-group input { flex: 1; }
.help { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }

/* Segmented control */
.segmented { display: inline-flex; background: #efeef1; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { margin: 0; }
.segmented input { display: none; }
.segmented label span {
  display: inline-block; padding: .4rem .8rem; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted);
}
.segmented input:checked + span { background: #fff; color: var(--plum); box-shadow: var(--shadow); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .8rem; border-radius: 999px;
  background: #f1eef4; border: 1px solid transparent; cursor: pointer; font-size: .88rem; user-select: none;
}
.chip input { display: none; }
.chip.on, .chip input:checked ~ * , .chip:has(input:checked) { background: var(--plum); color: #fff; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge.open { background: #dcfce7; color: #166534; }
.badge.sealed { background: #dbeafe; color: #1e40af; }
.badge.empty { background: #f3f4f6; color: #6b7280; }
.badge.expired { background: #fee2e2; color: #991b1b; }
.badge.plum { background: #f1eef4; color: var(--plum); }

/* Tables */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
table.data th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
table.data tr:hover td { background: #faf9fb; }

/* Flash */
.flash-wrap { position: fixed; top: 1rem; right: 1rem; z-index: 100; max-width: 360px; }
.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: .5rem; box-shadow: var(--shadow); color: #fff; font-weight: 500; }
.flash.success { background: var(--good); } .flash.error { background: var(--bad); }
.flash.info { background: var(--plum); } .flash.warning { background: var(--warn); }

/* Auth / marketing */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: linear-gradient(160deg, var(--plum) 0%, var(--plum-dark) 100%); }
.auth-card { background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 2rem; width: 100%; max-width: 420px; }
.auth-card .brand { font-size: 1.6rem; font-weight: 800; color: var(--plum); text-align: center; margin-bottom: .25rem; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.5rem; }
.auth-card .alt { text-align: center; margin-top: 1.25rem; font-size: .9rem; }

/* Progress bar */
.progress { height: 8px; background: #ece8ef; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--plum); }

/* Shot cycle ring */
.cycle-ring { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.cycle-ring .ring { position: relative; width: 180px; height: 180px; flex-shrink: 0; }
.cycle-ring .ring .pct { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cycle-ring .ring .pct b { font-size: 1.4rem; }

.list-reset { list-style: none; padding: 0; margin: 0; }
.flex { display: flex; } .between { justify-content: space-between; } .items-center { align-items: center; }
.gap { gap: .75rem; } .wrap { flex-wrap: wrap; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt2 { margin-top: 1.5rem; }
.right { text-align: right; } .center { text-align: center; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; border: 0; }
.kv { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.kv:last-child { border-bottom: 0; }
canvas { max-width: 100%; }
.hamburger { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; }
@media (max-width: 820px) { .hamburger { display: block; } }
.pill-row { display: flex; gap: .5rem; flex-wrap: wrap; }
