
:root {
  /* brand: the milize logo navy */
  --navy: #0b1f65;
  --navy-deep: #071443;
  --navy-soft: #16308f;
  --accent: #2f6bff;
  --accent-ink: #1f4fd8;
  --accent-weak: #e9efff;
  --accent-ring: rgba(47, 107, 255, 0.28);
  --mint: #12b3a0;

  --bg: #f2f5fb;
  --surface: #ffffff;
  --surface-alt: #f7f9fd;
  --border: #e2e7f3;
  --border-strong: #c9d1e6;
  --text: #0e1a3a;
  --muted: #5b6785;

  --ok: #0b7a62;
  --ok-bg: #e2f7f0;
  --ok-line: #b4e8d8;
  --warn: #8a5a00;
  --warn-bg: #fff5dd;
  --warn-line: #f2dca6;
  --danger: #c2362b;
  --danger-bg: #fdedeb;
  --danger-line: #f3c4be;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(11, 31, 101, 0.06);
  --shadow: 0 1px 2px rgba(11, 31, 101, 0.05), 0 14px 32px -18px rgba(11, 31, 101, 0.28);

  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", Meiryo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 14px/1.7 var(--font);
  background: linear-gradient(180deg, #e6ebf8 0, var(--bg) 280px) no-repeat, var(--bg);
  font-feature-settings: "palt";
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; line-height: 1.3; letter-spacing: .01em; }
.num, .count, .stat-value, .table td, .table th { font-variant-numeric: tabular-nums; }

/* ---------- app bar ---------- */
.appbar {
  position: relative; color: #fff;
  background:
    radial-gradient(900px 160px at 88% -70px, rgba(47, 107, 255, 0.45), transparent 65%),
    linear-gradient(110deg, var(--navy-deep), var(--navy) 55%, #11308f);
}
.appbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--mint) 55%, transparent 92%);
}
.appbar-inner { max-width: 1160px; margin: 0 auto; padding: 0 20px; min-height: 62px; display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { box-sizing: border-box; width: 38px; height: 38px; padding: 6px; color: #0B1F65; background: #fff; border-radius: 10px; flex: none; }
.brand-word { font: 800 19px/1 "Segoe UI", system-ui, sans-serif; letter-spacing: .04em; }
.brand-product { margin-left: 2px; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, 0.28); font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.82); }
.appbar-badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.22); }
.appbar-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.appbar-name { font-size: 13px; color: rgba(255, 255, 255, 0.92); }
.appbar-link { color: rgba(255, 255, 255, 0.82); font-size: 13px; }
.appbar-link:hover { color: #fff; }
.appbar form { margin: 0; }

/* ---------- layout ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 28px 20px 72px; display: grid; gap: 22px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--accent-ink); text-transform: uppercase; }
.page-title { font-size: 24px; font-weight: 800; }
.lead { margin: 4px 0 0; color: var(--muted); }
.grid-split { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); align-items: start; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stack { display: grid; gap: 14px; }

/* ---------- stat tiles ---------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--navy); background: linear-gradient(145deg, var(--accent-weak), #dbe6ff); flex: none; }
.stat-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--navy); }
.stat-label { margin-top: 2px; font-size: 12px; color: var(--muted); }

/* ---------- card ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.card-head h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, var(--accent), var(--navy)); }
.count { font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent-weak); padding: 2px 10px; border-radius: 999px; }
.pad { padding: 16px 20px; }
.pad-x { padding: 0 20px 16px; margin: 0; }
.empty { margin: 0; padding: 36px 20px; text-align: center; color: var(--muted); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); white-space: nowrap; padding: 10px 20px; background: var(--surface-alt); border-bottom: 1px solid var(--border); }
.table td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f5f8ff; }
.cell-name { font-weight: 700; word-break: break-all; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions > * { vertical-align: top; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; font-weight: 400; }
.muted { color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.8; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-public { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge-private { background: #eef1f8; color: var(--muted); border-color: var(--border); }
.badge-group { background: var(--accent-weak); color: var(--accent-ink); border-color: #cfdcff; }
.badge-group::before { display: none; }

/* ---------- forms ---------- */
.field { display: grid; gap: 5px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); }
input[type="text"], input[type="password"], input:not([type]), input[type="search"], input[type="date"], select, input[name] {
  font: inherit; color: inherit; background: #fff; width: 100%;
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder { color: #94a0bd; }
input:hover, select:hover { border-color: #aab5d3; }
input[type="checkbox"] { width: auto; accent-color: var(--navy); }
input[type="file"] { font: inherit; width: auto; max-width: 100%; padding: 7px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-alt); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[name] { width: auto; flex: 1 1 200px; }
form.inline { display: inline; margin: 0; }
.mono { font-family: var(--mono); letter-spacing: .08em; }
.code-input { max-width: 9em; font-size: 20px; text-align: center; }
.help { margin: 0; }
.searchbar { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: flex-end; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-alt); }
.searchbar .field { flex: 0 0 auto; }
.searchbar .grow { flex: 1 1 240px; }
.searchbar input, .searchbar select { width: auto; }
.searchbar .grow input { width: 100%; }
.searchbar select { min-width: 140px; }
.searchbar-actions { display: flex; gap: 8px; }
.upload-form { display: grid; gap: 12px; grid-template-columns: minmax(300px, 1.4fr) minmax(150px, 1fr) minmax(200px, 1.4fr) auto; align-items: end; }
.upload-form input[type="file"] { width: 100%; }
.file-comment { font-weight: 400; margin-top: 2px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  font: inherit; font-weight: 700; line-height: 1.2; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.btn:hover { background: #f1f4fb; border-color: #aab5d3; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #14308f, var(--navy)); border-color: var(--navy); color: #fff; box-shadow: 0 6px 14px -8px rgba(11, 31, 101, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.btn-primary:hover { background: linear-gradient(180deg, #1a3aa6, #0d2578); border-color: var(--navy-deep); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); background: #fff; }
.btn-danger:hover { background: var(--danger-bg); border-color: #e7a59d; }
.btn-ghost { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.32); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.5); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 18px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid; border-left-width: 4px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); border-left-color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); border-left-color: #e0a100; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); border-left-color: var(--mint); }
.narrow { max-width: 500px; }

/* ---------- access editor ---------- */
/* Expands inside the table row (not a floating popover, which the table's overflow would clip). */
details.editor { display: inline-block; text-align: left; vertical-align: top; }
details.editor > summary { list-style: none; cursor: pointer; }
details.editor > summary::-webkit-details-marker { display: none; }
.editor-panel { margin-top: 8px; min-width: 230px; display: grid; gap: 10px; padding: 14px; background: var(--surface-alt); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.check-tools { display: flex; gap: 14px; }
.btn-link { font: inherit; font-size: 13px; font-weight: 700; padding: 0; border: 0; background: none; color: var(--accent-ink); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.check-list { display: grid; gap: 7px; max-height: 220px; overflow: auto; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* ---------- sign-in: brand panel + form ---------- */
.auth-body { background: var(--bg); }
.auth-split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 44px 56px;
  background:
    radial-gradient(700px 420px at 12% 108%, rgba(18, 179, 160, 0.30), transparent 62%),
    radial-gradient(760px 520px at 92% -8%, rgba(47, 107, 255, 0.50), transparent 60%),
    linear-gradient(155deg, var(--navy-deep), var(--navy) 58%, #123396);
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 40%, #000, transparent 75%);
}
.auth-hero > * { position: relative; }
.auth-hero .brand-logo { width: 46px; height: 46px; padding: 7px; border-radius: 12px; }
.auth-hero .brand-word { font-size: 24px; }
.auth-headline { margin: 0; font-size: clamp(28px, 3.2vw, 42px); font-weight: 800; line-height: 1.28; letter-spacing: .01em; }
.auth-headline em { font-style: normal; background: linear-gradient(90deg, #8fb2ff, #5fe3cf); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-lead { margin: 16px 0 0; max-width: 34em; color: rgba(255, 255, 255, 0.8); font-size: 15px; }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.92); }
.auth-points .tick { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(95, 227, 207, 0.18); border: 1px solid rgba(95, 227, 207, 0.45); flex: none; }
.auth-points .tick svg { width: 13px; height: 13px; fill: none; stroke: #7ff0dd; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.auth-foot { font-size: 12px; color: rgba(255, 255, 255, 0.55); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-wrap-wide { max-width: 560px; }
.auth-card { padding: 34px; display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.auth-card-brand { display: none; align-items: center; gap: 10px; color: var(--navy); }
.auth-card-brand .brand-logo { padding: 0; background: none; border-radius: 0; width: 34px; height: 34px; }
.auth-card-brand .brand-word { font-size: 20px; }
.auth-title { font-size: 22px; font-weight: 800; }
.steps { margin: 0; padding-left: 1.4em; display: grid; gap: 18px; }
.steps li { padding-left: 4px; }
.steps li > * { display: block; margin-top: 4px; }
.steps li > strong { margin-top: 0; }
.steps .inline-form { display: flex; }
.qr { background: #fff; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
code { font-family: var(--mono); background: #eef1fa; padding: 1px 7px; border-radius: 6px; word-break: break-all; }
.codes { list-style: none; margin: 0; padding: 16px; display: grid; gap: 8px 16px; grid-template-columns: repeat(2, 1fr); background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (max-width: 960px) {
  .upload-form { grid-template-columns: 1fr; }
  .upload-form .btn { justify-self: start; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card-brand { display: flex; }
}
@media (max-width: 640px) {
  .container { padding-top: 18px; }
  .appbar-name, .brand-product { display: none; }
  .table th, .table td { padding-left: 12px; padding-right: 12px; }
  .page-title { font-size: 21px; }
  .auth-card { padding: 24px 20px; }
}
