/* Turbine Tools dashboard */
:root {
  --bg: #16161d; --panel: #20202a; --field: #2a2a36; --line: #2e2e3a;
  --fg: #ececf1; --muted: #9a9aae; --accent: #ff5c8a; --accent-dark: #d9416f;
  --ok: #4ade80; --bad: #f87171; --warn: #fbbf24; --info: #60a5fa;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
       font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 16px 60px; }

/* top bar */
.top { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px;
       background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { color: var(--fg); font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.top nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.top nav a { color: var(--muted); padding: 7px 12px; border-radius: 6px; white-space: nowrap; }
.top nav a:hover { color: var(--fg); background: var(--field); text-decoration: none; }
.top nav a.on { color: #fff; background: var(--field); box-shadow: inset 0 -2px 0 var(--accent); }
.logout { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* page head */
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.head .sub { color: var(--muted); margin-top: 2px; }

/* cards & grid */
.card { background: var(--panel); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cols > .card { margin-bottom: 0; }
.cols + .card, .cols + .cols { margin-top: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border-radius: 10px; padding: 16px; }
.tile .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tile .s { color: var(--muted); font-size: 12px; }

/* forms */
input, select, textarea, button { font: inherit; color: var(--fg); }
input, select, textarea { background: var(--field); border: 1px solid var(--line); border-radius: 6px;
                          padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 60px; }
label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 12px; align-items: start; }
.form .end { align-self: end; }
label .hint { margin-top: 0; }
.form .wide { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.btn, button { background: var(--field); border: 1px solid #3a3a48; border-radius: 6px; padding: 8px 14px;
               cursor: pointer; white-space: nowrap; display: inline-block; color: var(--fg); }
.btn:hover, button:hover { background: #34343f; text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover, button.primary:hover { background: var(--accent-dark); }
button.danger { color: var(--bad); }
button.small, .btn.small { padding: 4px 10px; font-size: 12px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input { max-width: 280px; } .filters select { width: auto; }

/* tables */
.tbl { overflow-x: auto; margin: -4px -6px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tr[data-href] { cursor: pointer; } tr[data-href]:hover td { background: #262630; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.grow { white-space: normal; min-width: 180px; }
.empty { color: var(--muted); padding: 20px 8px; text-align: center; }

/* badges & keys */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
         background: #2c2c38; color: var(--muted); }
.b-active, .b-ok, .b-done { background: rgba(74,222,128,.12); color: var(--ok); }
.b-revoked, .b-denied, .b-failed, .b-expired { background: rgba(248,113,113,.12); color: var(--bad); }
.b-started { background: rgba(251,191,36,.12); color: var(--warn); }
.hint code { word-break: break-all; }
code, .key { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.key { letter-spacing: .02em; }
.copy { cursor: copy; border-bottom: 1px dashed transparent; }
.copy:hover { border-bottom-color: var(--muted); }
.copy.copied { color: var(--ok) !important; }
.copy.copied::after { content: "  copied"; font-family: inherit; font-size: 11px; }
.bigkey { font-size: 22px; font-weight: 600; color: var(--fg); }

/* flash messages */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; background: var(--field); border-left: 3px solid var(--info); }
.f-ok { border-left-color: var(--ok); } .f-error { border-left-color: var(--bad); }
.newkeys { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; }
.newkeys .key { font-size: 18px; color: var(--ok); font-weight: 600; }

/* progress meter */
.meter { height: 8px; background: var(--field); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.full > i { background: var(--bad); }

/* 30-day chart */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.chart .bar { flex: 1; display: flex; flex-direction: column-reverse; min-width: 0; height: 100%; position: relative; }
.chart .bar i { display: block; width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 0; }
.chart .bar i.f { background: var(--bad); opacity: .7; border-radius: 0; }
.chart .bar:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: #000; color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 4px; white-space: nowrap; margin-bottom: 4px; z-index: 2; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--accent); margin-right: 5px; }
.legend i.f { background: var(--bad); opacity: .7; }

/* key/value list */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }

/* login */
body.guest { display: grid; place-items: center; min-height: 100vh; }
body.guest .wrap { width: 100%; max-width: 400px; }
.login h1 { margin-bottom: 4px; } .login .sub { color: var(--muted); margin-bottom: 18px; }
.login form { display: grid; gap: 12px; } .login button { margin-top: 6px; padding: 10px; }

@media (max-width: 760px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .top { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px 16px; }
  .top nav { order: 3; flex-basis: 100%; }
  .bigkey { font-size: 17px; }
}
