/* CRonos licence admin. Colours from the website (landing/css/site.css); system fonts so the
   page makes no outside request. */
:root {
  color-scheme: light;
  --navy: #0F4C5C;
  --bg: #FBF8F6;
  --surface: #FFFFFF;
  --surface2: #F6F1EE;
  --line: #EDE6E1;
  --line-strong: #DCD1CA;
  --text: #1E1B1F;
  --text-mid: #4B4549;
  --text-dim: #6D6569;
  --accent: #9A031E;
  --accent-hover: #5F0F40;
  --ok: #1F7A4D;
  --ok-soft: rgba(31, 122, 77, 0.11);
  --warn: #8A5A06;
  --warn-soft: rgba(251, 139, 36, 0.16);
  --danger: #B42F3A;
  --danger-soft: rgba(180, 47, 58, 0.10);
  --focus: #0F4C5C;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(60, 20, 35, 0.05), 0 12px 32px -14px rgba(60, 20, 35, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0; color: var(--navy); font-weight: 650; }
h2 { font-size: 1.05rem; margin: 2rem 0 .75rem; color: var(--navy); font-weight: 650; }
code, .mono { font-family: var(--font-mono); font-size: .9em; }
.muted { color: var(--text-dim); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Header */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
       padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: .6rem; }
.mark { font-weight: 700; color: var(--accent); font-size: 1.1rem; letter-spacing: -.01em; }
.sub { color: var(--text-dim); font-size: .9rem; }
.who { display: flex; align-items: center; gap: .75rem; color: var(--text-mid); font-size: .9rem; white-space: nowrap; }
.brand, .sub { white-space: nowrap; }

/* Buttons and fields */
.btn { font: inherit; font-size: .9rem; font-weight: 550; border-radius: var(--radius-sm); cursor: pointer;
       padding: .5rem .9rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: rgba(180, 47, 58, .4); }
.btn.danger:hover { background: var(--danger-soft); }
form#revokeForm .btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface2); }
.btn.link { border: 0; background: none; color: var(--navy); padding: .25rem 0; text-decoration: underline; text-underline-offset: 3px; }
.btn.wide { width: 100%; margin-top: 1rem; }
.btn:disabled { opacity: .55; cursor: default; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-mid); margin: .9rem 0 .3rem; }
input, textarea { font: inherit; width: 100%; padding: .55rem .7rem; border: 1px solid var(--line-strong);
                  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--text); margin-top: 1rem; }
label.check input { width: auto; }
.hint { font-size: .8rem; color: var(--text-dim); margin: .3rem 0 0; }
.form-error { color: var(--danger); font-size: .9rem; margin: .9rem 0 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.code-input { font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: .3em; text-align: center; }

/* Sign in */
.signin { display: grid; place-items: start center; padding: 10vh 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem; }
.narrow { width: 100%; max-width: 380px; }
.signin h1 { margin-bottom: .5rem; }

/* Main */
#app { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1.5rem 4rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.tab { font: inherit; font-weight: 600; font-size: .92rem; color: var(--text-dim); background: none; border: 0;
       padding: .6rem .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab[aria-current="page"] { color: var(--navy); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.search { flex: 1; }

.table-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .78rem; font-weight: 600; color: var(--text-dim); padding: .6rem .9rem;
            border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface2); }
.table td { padding: .6rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
#teamBody td { vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface2); }
.table .open { font: inherit; font-weight: 600; color: var(--navy); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.table .nowrap { white-space: nowrap; }
.table .detail { color: var(--text-mid); max-width: 360px; }
.table td .btn { padding: .25rem .55rem; font-size: .85rem; }
.table .group { display: block; font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim); font-weight: 400; }
.empty { color: var(--text-dim); padding: 1.5rem; text-align: center; }

.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px;
        background: var(--surface2); color: var(--text-mid); white-space: nowrap; }
.pill.active, .pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.revoked, .pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.expired, .pill.warn { background: var(--warn-soft); color: var(--warn); }

/* One key */
.back { margin-bottom: .75rem; }
.key-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1.5rem;
         background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 1rem 0; }
.facts dt { font-size: .78rem; font-weight: 600; color: var(--text-dim); }
.facts dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.inline-form { display: flex; align-items: center; gap: .6rem; }
.inline-form label { margin: 0; }
.inline-form input { width: 6rem; }
.events { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.events li { padding: .6rem .9rem; border-bottom: 1px solid var(--line); font-size: .9rem; display: grid;
             grid-template-columns: 11rem 1fr; gap: .75rem; }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--text-dim); }

/* Dialogs */
dialog { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.75rem; width: min(520px, calc(100vw - 2rem)); color: var(--text); }
dialog::backdrop { background: rgba(30, 27, 31, .45); }
dialog h2 { margin-top: 0; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.5rem; }
.the-key { background: var(--surface2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 1rem; text-align: center; }
.the-key code { font-size: 1.35rem; letter-spacing: .06em; user-select: all; }
.warn { color: var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: .6rem .8rem; font-size: .9rem; }

.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff;
         padding: .6rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; box-shadow: var(--shadow); }

@media (max-width: 640px) {
  .bar { padding: .75rem 1rem; }
  .sub, #whoEmail { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .row { grid-template-columns: 1fr; }
  .events li { grid-template-columns: 1fr; gap: .2rem; }
}

/* Team */
.add-form { margin: 0 0 .5rem; flex-wrap: wrap; }
.add-form input[type=email] { width: min(22rem, 100%); }
select { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
         background: var(--surface); color: var(--text); }
select:focus { outline: 2px solid var(--focus); border-color: var(--focus); }
