:root {
  color-scheme: light;
  font: 15px/1.5 "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --canvas: #f8f9fc;
  --surface: #fff;
  --text: #181b2b;
  --muted: #626a7e;
  --border: #e5e8f1;
  --control: #dbe0ec;
  --accent: #5541bc;
  --accent-strong: #4935a8;
  --accent-soft: #f0edff;
  --neutral-soft: #f3f5fa;
  --success: #28654b;
  --success-soft: #e9f6ee;
  --warning: #835018;
  --warning-soft: #fff3df;
  --danger: #9a2544;
  --danger-soft: #fdf0f3;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--text); }
button, input, select { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 42px;
  padding: .55rem .9rem;
  border: 1px solid var(--control);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-weight: 630;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--neutral-soft); }
button:disabled { opacity: .6; cursor: wait; }
.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.danger { color: var(--danger); border-color: #efcad5; }
.danger:hover { background: var(--danger-soft); }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, p, dd, dl { margin: 0; }
h1, h2 { letter-spacing: -.035em; line-height: 1.16; }
h1 { font-size: clamp(1.85rem, 4.2vw, 2.65rem); font-weight: 720; }
h2 { font-size: 1.45rem; }
.muted, small { color: var(--muted); }
.loading, .empty { padding: 1.25rem; color: var(--muted); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.55rem;
  padding: 1.4rem 1rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.rail-brand { padding-inline: .45rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); font-size: 1.04rem; letter-spacing: -.025em; }
.brand strong { font-weight: 730; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: var(--accent);
}
.brand-mark::after { content: ""; width: 11px; height: 13px; margin-left: 2px; background: white; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.rail nav { display: grid; gap: .34rem; }
.rail nav a {
  display: flex;
  align-items: center;
  gap: .68rem;
  min-height: 43px;
  padding: .5rem .68rem;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 620;
}
.rail nav a:hover { background: var(--neutral-soft); color: var(--text); }
.rail nav a[aria-current] { color: var(--accent-strong); background: var(--accent-soft); }
.rail-account { display: grid; gap: .7rem; margin-top: auto; padding: 1rem .45rem 0; border-top: 1px solid var(--border); }
.admin-identity { display: grid; gap: .12rem; min-width: 0; overflow-wrap: anywhere; }
.sign-out { justify-self: start; min-height: 36px; padding: .3rem .65rem; font-size: .86rem; }

.workspace { width: min(100%, 1190px); min-width: 0; padding: 1.3rem clamp(1.2rem, 4.2vw, 3.8rem) 3rem; margin: 0 auto; }
.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem .9rem;
  flex-wrap: wrap;
  padding-bottom: .9rem;
  margin-bottom: 1.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: .86rem;
  font-weight: 600;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  padding: .27rem .58rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 630;
}
.environment-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.page-head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .9rem 1.4rem; margin-bottom: 1.4rem; }
.page-head p { margin-top: .45rem; }
.page-head button { flex: 0 0 auto; }
.add-mark { font-size: 1.16rem; font-weight: 460; line-height: 1; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.35rem; }
.account-metrics { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }
.metric {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: .45rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.metric-label { display: inline-flex; align-items: center; gap: .5rem; width: fit-content; color: var(--status-ink, var(--muted)); font-size: .86rem; font-weight: 630; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.metric strong { font-size: 1.8rem; line-height: 1.14; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
[data-status="active"], [data-status="resolved"] { --status-ink: var(--success); --status-surface: var(--success-soft); }
[data-status="invited"], [data-status="investigating"] { --status-ink: var(--warning); --status-surface: var(--warning-soft); }
[data-status="grace"] { --status-ink: var(--warning); --status-surface: var(--warning-soft); }
[data-status="open"] { --status-ink: var(--accent-strong); --status-surface: var(--accent-soft); }

.board { overflow: clip; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tools, .actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.tools { justify-content: space-between; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.search-field { position: relative; width: min(100%, 310px); }
.search-field .icon { position: absolute; top: 12px; left: 11px; color: var(--muted); pointer-events: none; }
input, select {
  min-height: 42px;
  max-width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--control);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
}
input::placeholder { color: var(--muted); }
.search-field input { width: 100%; padding-left: 2.25rem; }
table { width: 100%; border-collapse: collapse; overflow-wrap: anywhere; }
th, td { padding: .85rem 1rem; text-align: left; vertical-align: middle; }
th { background: #f9fafe; color: var(--muted); font-size: .79rem; font-weight: 650; }
td { border-top: 1px solid var(--border); }
tbody tr:hover { background: #fafbfe; }
td strong, td small, td code { display: block; }
td code, .issue-code { color: #574473; font-size: .77rem; overflow-wrap: anywhere; }
.row-title { margin-bottom: .13rem; font-weight: 670; }
td .link {
  display: inline;
  padding: 0;
  min-height: 0;
  border: none;
  background: transparent;
  color: var(--accent-strong);
  text-align: left;
}
td .link:hover { background: transparent; text-decoration: underline; }
.chip {
  display: inline-block;
  padding: .22rem .55rem;
  border-radius: 20px;
  background: var(--status-surface, var(--neutral-soft));
  color: var(--status-ink, var(--muted));
  font-size: .8rem;
  font-weight: 650;
  white-space: nowrap;
}
.mobile-meta { display: none; }
.alert { padding: .8rem .95rem; margin-block: .75rem; border: 1px solid #f5d9e1; border-radius: 9px; background: var(--danger-soft); color: var(--danger); }
.alert button { margin-top: .55rem; }
.notice { margin-bottom: .75rem; color: var(--success); }

.auth {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 1.2rem;
  background: radial-gradient(ellipse at 50% 13%, #eeebff 0, transparent 52%), var(--canvas);
}
.auth-frame { width: min(100%, 440px); }
.auth-card {
  padding: clamp(1.35rem, 5vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 20px 52px #3226660c;
}
.auth-card .brand { margin-bottom: 1.6rem; }
.auth-card h1, .auth-card h2 { margin-bottom: .6rem; }
.auth-card h1 { font-size: clamp(1.55rem, 4vw, 2rem); }
.auth-card form { margin-top: 1.4rem; }
.auth-card .primary { margin-top: .18rem; }
.auth-environment { display: flex; justify-content: center; padding-top: .9rem; }
form { display: grid; gap: .9rem; }
form label { display: grid; gap: .35rem; font-weight: 650; }
form input, form select { width: 100%; font-weight: normal; }
form .alert { margin-block: 0; }
dialog {
  width: min(470px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 25px 70px #18152e30;
}
dialog::backdrop { background: #201d3670; }
dialog p { margin-block: .4rem .5rem; }
dialog .actions { justify-content: flex-end; margin-top: .35rem; }
dialog > label { display: grid; gap: .35rem; font-weight: 650; }
dialog > label input { width: 100%; font-weight: normal; }
dialog dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; padding: .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--canvas); }
dt { color: var(--muted); font-size: .81rem; }
dd { overflow-wrap: anywhere; font-weight: 650; }

.icon { position: relative; display: inline-block; flex: 0 0 17px; width: 17px; height: 17px; color: inherit; }
.icon::before, .icon::after { position: absolute; content: ""; }
.icon-account::before { top: 1px; left: 6px; width: 6px; height: 6px; border: 1.4px solid; border-radius: 50%; }
.icon-account::after { bottom: 1px; left: 2px; width: 14px; height: 7px; border: 1.4px solid; border-radius: 7px 7px 3px 3px; }
.icon-issue::before { inset: 1px; border: 1.4px solid; border-radius: 50%; }
.icon-issue::after { top: 4px; left: 8px; width: 1.5px; height: 8px; background: linear-gradient(currentColor 67%, transparent 67% 83%, currentColor 83%); }
.icon-refresh::before { inset: 2px; border: 1.4px solid; border-right-color: transparent; border-radius: 50%; }
.icon-refresh::after { top: 1px; right: 1px; width: 5px; height: 5px; border-right: 1.4px solid; border-bottom: 1.4px solid; }
.icon-search::before { top: 1px; left: 1px; width: 11px; height: 11px; border: 1.4px solid; border-radius: 50%; }
.icon-search::after { top: 11px; left: 10px; width: 6px; height: 1.4px; transform: rotate(48deg); transform-origin: left center; background: currentColor; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem .7rem;
    height: auto;
    padding: .65rem 1rem .25rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .rail-brand { padding: 0; }
  .rail nav { grid-row: 2; grid-column: 1 / -1; display: flex; flex-wrap: wrap; }
  .rail nav a { padding-inline: .65rem; }
  .rail-account { grid-row: 1; grid-column: 2; margin: 0; padding: 0; border: none; }
  .admin-identity { display: none; }
  .workspace { padding-top: .8rem; }
  .topline { margin-bottom: 1.15rem; }
}
@media (max-width: 525px) {
  .workspace { padding-inline: .85rem; }
  .metrics { gap: .42rem; }
  .metric { padding: .72rem .52rem; gap: .35rem; border-radius: 11px; }
  .metric strong { font-size: 1.48rem; }
  .metric-label { gap: .27rem; font-size: .76rem; }
  .status-dot { width: 5px; height: 5px; }
  .tools { padding: .7rem; }
  .search-field { width: 100%; }
  th, td { padding: .7rem .52rem; }
  td small { font-size: .75rem; }
  .table-date, .table-count { display: none; }
  .mobile-meta { display: block; margin-top: .06rem; }
}
