@font-face { font-family: "Schibsted Grotesk"; src: url("fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

/* Brass is the key, verdigris is access granted, oxide is access taken away. */
:root {
	color-scheme: light;
	--bg: #e8edf1;
	--surface: #f7f9fa;
	--ink: #16262f;
	--muted: #53656f;
	--line: #c9d4da;
	--verdigris: #1c6e63;
	--oxide: #a63d2b;
	--brass: #d2a441;
	--on-brass: #221a07;
	--font: "Schibsted Grotesk", system-ui, sans-serif;
	--mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

:root.sl-theme-light, :root.sl-theme-dark {
	--sl-font-sans: var(--font);
	--sl-font-mono: var(--mono);
	--sl-input-background-color: var(--surface);
	--sl-input-background-color-hover: var(--surface);
	--sl-input-background-color-focus: var(--surface);
	--sl-input-border-color: var(--line);
	--sl-input-color: var(--ink);
	--sl-input-label-color: var(--ink);
	--sl-panel-background-color: var(--surface);
	--sl-panel-border-color: var(--line);
}

:root.sl-theme-light {
	--sl-color-primary-50: #eaf6f3; --sl-color-primary-100: #cdeae4; --sl-color-primary-200: #9fd6cb;
	--sl-color-primary-300: #6bbdae; --sl-color-primary-400: #3ca091; --sl-color-primary-500: #25877a;
	--sl-color-primary-600: #1c6e63; --sl-color-primary-700: #175a51; --sl-color-primary-800: #134a43;
	--sl-color-primary-900: #0f3b36; --sl-color-primary-950: #0a2825;
}

/* Shoelace inverts its colour scales in dark mode. */
:root.sl-theme-dark {
	color-scheme: dark;
	--bg: #101c22;
	--surface: #17262e;
	--ink: #e3ebee;
	--muted: #98a9b2;
	--line: #2d414b;
	--verdigris: #61c5b2;
	--oxide: #ee8c7a;
	--brass: #ddb25a;
	--sl-color-primary-50: #0a2825; --sl-color-primary-100: #0f3b36; --sl-color-primary-200: #134a43;
	--sl-color-primary-300: #175a51; --sl-color-primary-400: #1f7a6d; --sl-color-primary-500: #3ca091;
	--sl-color-primary-600: #61c5b2; --sl-color-primary-700: #80d3c3; --sl-color-primary-800: #9fdfd3;
	--sl-color-primary-900: #cdeae4; --sl-color-primary-950: #eaf6f3;
}

* { box-sizing: border-box; }
body { margin: 0; font: 400 15px/1.5 var(--font); background: var(--bg); color: var(--ink); }
sl-input:not(:defined), sl-switch:not(:defined), sl-checkbox:not(:defined), sl-button:not(:defined), sl-icon-button:not(:defined), sl-copy-button:not(:defined) { visibility: hidden; }
:focus-visible { outline: 2px solid var(--verdigris); outline-offset: 2px; }
a { color: var(--verdigris); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 650; }
code { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand svg { width: 22px; height: 22px; color: var(--brass); flex: none; }
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { padding: 6px 0; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; }
.topbar nav a:hover { color: var(--ink); }
.topbar nav a[aria-current=page] { color: var(--ink); border-bottom-color: var(--brass); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.text-button { font: inherit; font-weight: 500; padding: 6px 8px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; }
.text-button:hover { color: var(--ink); }

main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }

/* The key tag: the punched hole and chamfered corners make it read as an object, not a notice. */
.key-tag {
	--notch: 18px;
	position: relative;
	margin-bottom: 36px;
	padding: 24px 28px 26px 84px;
	background: var(--brass);
	color: var(--on-brass);
	clip-path: polygon(var(--notch) 0, 100% 0, 100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
	-webkit-mask: radial-gradient(circle 13px at 42px 50%, transparent 98%, #000);
	mask: radial-gradient(circle 13px at 42px 50%, transparent 98%, #000);
	animation: tag-in .35s cubic-bezier(.2, .8, .3, 1);
}
@keyframes tag-in { from { transform: translateY(-10px) rotate(-.6deg); opacity: 0; } }
.key-tag h2 { font-size: 22px; letter-spacing: -.01em; }
.key-tag p { margin-top: 2px; font-weight: 500; }
.key-tag h3 { margin-top: 18px; font-size: 14px; font-weight: 650; }
.secret { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 10px 10px 10px 14px; background: rgb(255 255 255 / .42); border-radius: 3px; }
.secret code { flex: 1; min-width: 0; padding-top: 5px; color: var(--on-brass); overflow-wrap: anywhere; user-select: all; }
.secret.primary code { font-size: 17px; font-weight: 600; padding-top: 3px; }
.secret sl-copy-button { flex: none; --success-color: #0e4a41; --error-color: #7c2415; }
.secret sl-copy-button::part(button) { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; padding: 0; color: #fff; background: var(--on-brass); border-radius: 4px; opacity: 1; }
.secret sl-copy-button::part(button):hover { background: #3f3210; }

.alert { margin-bottom: 24px; padding: 12px 16px; border-left: 3px solid var(--oxide); background: var(--surface); }

.composer { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 40px; align-items: start; margin-top: 16px; }
.name-field { max-width: 380px; }
.key-type { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 620px; margin: 22px 0 0; padding: 0; border: 0; }
.key-type legend { margin-bottom: 8px; padding: 0; font-weight: 500; }
.type-card { position: relative; display: block; padding: 12px 14px 13px 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.type-card:hover { border-color: var(--muted); }
.type-card input { position: absolute; left: 14px; top: 15px; margin: 0; accent-color: var(--verdigris); }
.type-card:has(input:checked) { border-color: var(--verdigris); box-shadow: inset 0 0 0 1px var(--verdigris); }
.type-card:has(input:focus-visible) { outline: 2px solid var(--verdigris); outline-offset: 2px; }
.type-name { display: block; font-weight: 650; }
.type-desc { display: block; margin-top: 2px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.type-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; font-size: 12px; font-weight: 500; color: var(--verdigris); border: 1px solid currentColor; border-radius: 3px; white-space: nowrap; }
.type-badge.business { color: var(--on-brass); background: var(--brass); border-color: var(--brass); }
tr.revoked .type-badge { color: var(--muted); background: none; border-color: var(--line); }
.superadmin { display: block; margin: 22px 0 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.hint { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.team { padding: 16px 0 18px; border-top: 1px solid var(--line); }
.team-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; }
.team-head h3 { font-size: 15px; font-weight: 650; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; margin-top: 12px; }
.project-grid small { color: var(--muted); font-size: 12px; margin-left: 4px; }

.summary { position: sticky; top: 20px; padding: 18px 20px 20px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--verdigris); }
.summary-title { font-size: 13px; color: var(--muted); }
.summary output { display: block; min-height: 54px; margin: 4px 0 16px; font-size: 19px; line-height: 1.3; font-weight: 650; }
.summary output.empty { color: var(--muted); font-weight: 500; font-size: 15px; }
.summary sl-button { width: 100%; }

.section-title { margin: 48px 0 12px; }
.scroll { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 14px; vertical-align: top; }
th { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr + tr td { border-top: 1px solid var(--line); }
td.nowrap { white-space: nowrap; }
td.break { min-width: 160px; overflow-wrap: anywhere; }
details.detail { margin-top: 4px; }
details.detail summary { cursor: pointer; color: var(--muted); }
details.detail div { margin-top: 6px; white-space: pre-wrap; max-width: 60ch; }
.access-line + .access-line { margin-top: 2px; }
.access-line b { font-weight: 500; color: var(--muted); }
.superadmin-mark { font-weight: 650; }
.superadmin-mark::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; background: var(--brass); transform: rotate(45deg); }
tr.revoked td { color: var(--muted); }
tr.revoked .superadmin-mark::before { background: var(--line); }
.empty-note { padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.outcome-ok { color: var(--verdigris); font-weight: 600; }
.outcome-error { color: var(--oxide); overflow-wrap: anywhere; }

.alert.ok { border-left-color: var(--verdigris); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.block { display: block; }
.error-text { display: block; color: var(--oxide); overflow-wrap: anywhere; max-width: 36ch; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head p { margin-top: 6px; max-width: 64ch; }
.token-card { margin-top: 24px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brass); }
.token-card p { margin-top: 2px; }
.token-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.token-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.token-form sl-input { width: min(420px, 100%); }
.token-form sl-button { margin-top: 26px; }
.team-block { margin-top: 36px; }
.team-name { margin-bottom: 10px; }
.project-card { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); scroll-margin-top: 16px; }
.project-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.project-head h3 { font-size: 16px; font-weight: 650; }
.project-head p { font-size: 13px; }
.project-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.version-field { width: 120px; }
.project-card .scroll { border: 0; }
.repo-table td { vertical-align: middle; }
.repo-table td:nth-child(2) { min-width: 340px; }
.branch-cell { min-width: 170px; }
.status-cell { min-width: 150px; }
.sync-state { font-weight: 600; }
.sync-state[data-state=READY] { color: var(--verdigris); }
.sync-state[data-state=FAILED] { color: var(--oxide); }
.sync-state[data-state=NOT_CLONED] { color: var(--muted); }
.sync-state[data-state=PENDING], .sync-state[data-state=SYNCING] { color: var(--brass); }

.login { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.login-top { display: flex; justify-content: flex-end; padding: 10px 16px; }
.login-panel { align-self: center; justify-self: center; width: min(100% - 32px, 380px); margin-bottom: 12vh; }
.login-panel .brand { margin-bottom: 18px; font-size: 16px; }
.login-panel p { margin: 6px 0 22px; color: var(--muted); }
.login-panel label { display: block; margin-top: 14px; font-weight: 500; }
.login-panel input { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.login-panel button { width: 100%; margin-top: 20px; padding: 10px; font: inherit; font-weight: 600; color: #fff; background: #1c6e63; border: 0; border-radius: 4px; cursor: pointer; }
.login-panel button:hover { background: #175a51; }
.login-panel .alert { margin: 0 0 8px; }

@media (max-width: 820px) {
	.composer { grid-template-columns: minmax(0, 1fr); gap: 20px; }
	.summary { position: static; }
	.key-type { grid-template-columns: minmax(0, 1fr); }
	main { padding: 24px 16px 48px; }
	.topbar { padding: 10px 16px; }
	.key-tag { --notch: 12px; padding: 62px 18px 20px; -webkit-mask: radial-gradient(circle 11px at 50% 30px, transparent 98%, #000); mask: radial-gradient(circle 11px at 50% 30px, transparent 98%, #000); }
	.secret.primary code { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.key-tag { animation: none; }
}
