:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e3e3e8;
  --bg: #f5f5f7;
  --white: #fff;
  --accent: #0066cc;
  --accent-ink: #004f9e;
  --accent-bg: #eaf3ff;
  --red: #c4301c; --red-bg: #fdecea;
  --amber: #8a4b00; --amber-bg: #fdf1dd;
  --green: #14683a; --green-bg: #e6f4ec;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.47; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 3px solid rgba(0, 102, 204, 0.4); outline-offset: 2px; }

/* Sign-in screens */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--white); border-radius: 28px; padding: 40px 36px; box-shadow: 0 12px 40px rgba(0,0,0,.06); }
.auth-card img { width: 48px; height: 48px; border-radius: 11px; }
.auth-card h1 { margin: 18px 0 6px; }
.auth-card form { margin-top: 24px; display: grid; gap: 14px; }

label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--white);
  border: 1px solid #d2d2d7; border-radius: 12px; padding: 11px 14px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,102,204,.18); }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 980px;
  padding: 10px 18px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover { background: var(--accent-ink); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--accent-bg); color: var(--accent-ink); }
button.secondary:hover { background: #d9e9fc; }
button.danger { background: var(--red-bg); color: var(--red); }
button.danger:hover { background: #fadad5; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; }
.error { color: var(--red); font-size: 14px; min-height: 1em; }
.notice { background: var(--accent-bg); color: var(--accent-ink); border-radius: 12px; padding: 12px 14px; font-size: 14px; }

/* Shell */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: rgba(255,255,255,.7); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; justify-content: flex-start; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; padding: 0 10px 18px; color: var(--ink); }
.side .brand img { width: 26px; height: 26px; border-radius: 7px; }
.side a, .side span.soon { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--ink); }
.side a:hover { background: var(--bg); text-decoration: none; }
.side a.on { background: var(--accent-bg); color: var(--accent-ink); font-weight: 600; }
.side span.soon { color: var(--muted); }
.side span.soon em { font-style: normal; font-size: 11px; background: var(--bg); border-radius: 6px; padding: 1px 6px; }
.side .label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 16px 10px 4px; }
.side .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.side .me a { padding: 0; display: inline; }
.side .me a:hover { background: none; text-decoration: underline; }
.main { padding: 32px 40px 60px; max-width: 1100px; width: 100%; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

.card { background: var(--white); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; }
.card h2 { margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--white); border-radius: var(--radius); padding: 18px 20px; }
.stat b { display: block; font-size: 30px; letter-spacing: -0.02em; }
.stat span { color: var(--muted); font-size: 13px; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.bars-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fafafc; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 980px; padding: 2px 9px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.blue { background: var(--accent-bg); color: var(--accent-ink); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { max-width: 320px; }
.toolbar select { width: auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.note { border-top: 1px solid var(--line); padding: 12px 0; }
.note:first-child { border-top: 0; }
.note p { white-space: pre-wrap; }
.linkbox { word-break: break-all; background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-top: 8px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .label, .side span.soon { display: none; }
  .side .brand { width: 100%; padding-bottom: 8px; }
  .side .me { width: 100%; border-top: 0; padding-top: 6px; }
  .main { padding: 20px 16px 48px; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
