/* HBLAB Shorten — app styles (2026 redesign). No framework; tokens follow the design canvas. */
:root {
  --hbl-yellow: #FDC010;
  --hbl-yellow-soft: #FFF4CC;
  --hbl-yellow-tint: #FFFAEB;
  --hbl-yellow-ink: #8A6500;
  --charcoal: #232325;
  --charcoal-2: #2B2B2E;
  --charcoal-3: #3A3A3E;
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --ink: #1F1F21;
  --ink-2: #4A4A50;
  --muted: #5B5B61;
  --line: #E2E0D9;
  --line-2: #ECEAE4;
  --field: #D3D1CA;
  --nav-ink: #E4E4E7;
  --nav-muted: #A1A1A8;
  --nav-dim: #C9C9CE;
  --link: #1D4F91;
  --link-hover: #123663;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --success: #1E6B3A;
  --success-soft: #E5F4EA;
  --font-head: Archivo, system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
}
:lang(ja) body, body:lang(ja) { font-family: 'IBM Plex Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Meiryo, sans-serif; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; }
p { margin: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--hbl-yellow);
  outline-offset: 1px;
}
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--hbl-yellow); color: var(--ink); padding: 10px 16px; border-radius: var(--radius); font-weight: 600;
}
.skip-link:focus { top: 8px; }
.mono { font-family: var(--font-mono); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark { display: block; width: 22px; height: 22px; background: var(--hbl-yellow); transform: skewX(-14deg); flex: none; }
.brand-hbl { font: 800 20px var(--font-head); letter-spacing: 0.04em; }
.brand-name { font: 600 20px var(--font-head); color: var(--nav-dim); }
.brand-sm .brand-mark { width: 16px; height: 16px; }
.brand-sm .brand-hbl, .brand-sm .brand-name { font-size: 16px; }

/* ---------- Language switcher (flags) ---------- */
.lang-switch { display: flex; gap: 4px; margin: 0; }
.lang-switch button {
  height: 36px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 6px;
  background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.lang-switch button:hover { background: var(--charcoal-3); }
.lang-switch button[aria-pressed="true"] { background: var(--charcoal-3); box-shadow: inset 0 -2px 0 var(--hbl-yellow); }
.lang-switch svg { display: block; width: 22px; height: 15px; border-radius: 2px; }

/* ---------- Guest shell (top bar, no sidebar) ---------- */
.guest-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--charcoal); }
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px clamp(16px, 3vw, 32px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
}
.topbar-inner .brand { margin-right: auto; }
.btn-google {
  height: 44px; display: inline-flex; align-items: center; gap: 10px; padding: 0 18px; border-radius: var(--radius);
  background: #fff; color: var(--ink); font-weight: 600; text-decoration: none;
}
.btn-google:hover { color: var(--ink); background: #F1F1F1; }
.g-mark {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font: 700 11px var(--font-head);
}
.guest-main {
  flex: 1; width: 100%; max-width: 1120px; margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) clamp(16px, 3vw, 32px) 56px;
  display: flex; flex-direction: column; gap: 40px;
}
.site-footer { text-align: center; padding: 20px 16px; font-size: 13px; color: var(--muted); }

/* ---------- Signed-in shell (sidebar) ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  flex: 0 0 256px; width: 256px; background: var(--charcoal); color: var(--nav-ink);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px; }
.nav-toggle {
  display: none; width: 44px; height: 44px; border: 1px solid var(--charcoal-3); border-radius: var(--radius);
  background: transparent; color: #fff; cursor: pointer; align-items: center; justify-content: center;
}
.sidebar-body { display: flex; flex-direction: column; gap: 24px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--nav-muted); padding: 0 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius);
  color: var(--nav-ink); text-decoration: none;
}
.nav-link:hover { background: var(--charcoal-3); color: #fff; }
.nav-link[aria-current="page"] { background: var(--hbl-yellow); color: var(--ink); font-weight: 600; }
.nav-link svg { flex: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--charcoal-3); padding-top: 16px; }
.sidebar-foot .lang-switch { padding: 0 12px 8px; }
.sidebar-foot .lang-switch button { flex: 1; height: 32px; }
.nav-link-sm { min-height: 40px; color: var(--nav-dim); font-size: 14px; }
.user-block { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--hbl-yellow); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px;
  flex: none; overflow: hidden; object-fit: cover;
}
.avatar-lg { width: 96px; height: 96px; font-size: 32px; }
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name { font-weight: 600; color: #fff; font-size: 14px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name:hover { color: var(--hbl-yellow); }
.user-role { font-size: 12px; color: var(--nav-muted); }
.icon-btn-dark {
  color: var(--nav-dim); display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center;
  border-radius: var(--radius); flex: none;
}
.icon-btn-dark:hover { color: #fff; background: var(--charcoal-3); }

.app-main {
  flex: 1; min-width: 0; padding: 40px clamp(16px, 4vw, 56px) 48px;
  display: flex; flex-direction: column; gap: 24px;
}
.app-main > .site-footer { margin-top: auto; padding-bottom: 0; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex: none; padding: 12px 16px; gap: 0; }
  .nav-toggle { display: inline-flex; }
  .sidebar-body { display: none; padding-top: 16px; }
  .sidebar.is-open .sidebar-body { display: flex; }
  .app-main { padding-top: 28px; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { font: 800 34px/1.15 var(--font-head); letter-spacing: -0.01em; }
.page-sub { margin-top: 6px; color: var(--muted); }
.eyebrow {
  display: flex; align-items: center; gap: 10px; font: 600 13px var(--font-mono);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--hbl-yellow-ink);
}
.eyebrow::before { content: ""; display: block; width: 10px; height: 10px; background: var(--hbl-yellow); transform: skewX(-14deg); }

/* ---------- Buttons ---------- */
.btn {
  height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px;
  border-radius: var(--radius); border: 1px solid var(--field); background: var(--surface); color: var(--ink);
  font: 500 15px var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { color: var(--ink); background: var(--surface-2); border-color: #BDBAB1; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--hbl-yellow); border-color: var(--hbl-yellow); font: 700 15px var(--font-head); }
.btn-primary:hover { background: #F2B600; border-color: #F2B600; }
.btn-dark { background: var(--charcoal-2); border-color: var(--charcoal-2); color: #fff; font-weight: 600; }
.btn-dark:hover { background: #000; color: #fff; }
.btn-ghost-dark { background: transparent; border-color: #55555B; color: var(--bg); }
.btn-ghost-dark:hover { background: var(--charcoal-3); color: #fff; border-color: #6A6A70; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn .spinner { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 14px; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); }
.input, .select {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--field);
  border-radius: var(--radius); padding: 0 12px; height: 44px; width: 100%; min-width: 0;
}
.input:disabled { background: var(--bg); color: var(--muted); }
.input-lg { height: 52px; font-size: 16px; }
.input-mono { font-family: var(--font-mono); }
.input-group { display: flex; align-items: stretch; }
.input-addon {
  display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--field); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius); background: var(--bg); font: 500 14px var(--font-mono); color: var(--muted);
  white-space: nowrap;
}
.input-group .input { border-radius: 0 var(--radius) var(--radius) 0; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--charcoal-2); margin: 0; flex: none; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.row-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-inline > .grow { flex: 1 1 280px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.card-pad { padding: 20px 24px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { font: 700 16px var(--font-head); }
.card-sub { margin-top: 2px; font-size: 14px; color: var(--muted); }

.option { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.option:last-child { border-bottom: 0; }
.option-label { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.option-label input { margin-top: 2px; }
.option-text { display: flex; flex-direction: column; gap: 2px; }
.option-title { font-weight: 600; }
.option-desc { color: var(--muted); font-size: 14px; }
.option-body { margin-left: 34px; max-width: 460px; }

/* ---------- Create link (home, signed in) ---------- */
.quota { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.quota-bar { display: block; width: 120px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.quota-bar > span { display: block; height: 100%; background: var(--charcoal-2); }
.quota strong { color: var(--ink); }
.create-grid { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.create-form { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; margin: 0; }
.result {
  flex: 1 1 300px; min-width: 0; background: var(--charcoal-2); color: var(--bg); border-radius: 14px; padding: 24px;
  display: flex; flex-direction: column; gap: 18px; position: sticky; top: 24px;
}
.result-label {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--hbl-yellow);
}
.result-label::before { content: ""; display: block; width: 10px; height: 10px; background: var(--hbl-yellow); transform: skewX(-14deg); }
.result-link { font: 500 22px var(--font-mono); color: #fff; word-break: break-all; text-decoration: none; }
.result-link:hover { color: var(--hbl-yellow); }
.result-empty { color: #D6D6D9; font-size: 14px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.result-actions .btn { flex: 1 1 auto; }
.qr-box { background: #fff; border-radius: 10px; padding: 16px; display: flex; justify-content: center; }
.qr-box img, .qr-box canvas { width: 184px !important; height: 184px !important; }
.result-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: #D6D6D9; }
.result-meta li { display: flex; justify-content: space-between; gap: 12px; }
.result-meta strong { color: #fff; font-weight: 500; }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
@media (max-width: 900px) { .result { position: static; } }

/* ---------- Guest home ---------- */
.hero { display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.hero h1 { font: 800 clamp(36px, 6vw, 60px)/1.05 var(--font-head); letter-spacing: -0.02em; }
.hero p { font-size: 18px; color: var(--ink-2); }
.try { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature { border-top: 3px solid var(--charcoal-2); padding-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.feature h2 { font: 700 17px var(--font-head); }
.feature p { color: var(--ink-2); font-size: 14px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font: 800 28px var(--font-head); }

/* ---------- Tables ---------- */
.table-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FCFBF8; }
.table .num { text-align: right; }
.cell-url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
.cell-url a { color: inherit; text-decoration: none; }
.cell-url a:hover { text-decoration: underline; color: var(--link); }
.cell-wrap { max-width: 360px; word-break: break-all; font-size: 13px; color: var(--ink-2); }
.cell-actions { white-space: nowrap; text-align: right; }
.cell-actions > * + * { margin-left: 6px; }
.short-link { font: 500 14px var(--font-mono); text-decoration: none; }
.short-link:hover { text-decoration: underline; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
  border-radius: 999px; padding: 2px 10px; white-space: nowrap; background: var(--bg); color: var(--ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge-yellow { background: var(--hbl-yellow-soft); color: #5C4300; }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-dark { background: var(--charcoal-2); color: var(--hbl-yellow); }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 14px; color: var(--muted); }
.pager-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pager-list a, .pager-list span {
  min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); border: 1px solid var(--field); color: var(--ink); text-decoration: none; background: var(--surface);
}
.pager-list a:hover { background: var(--surface-2); }
.pager-list a[aria-current="page"] { background: var(--charcoal-2); border-color: var(--charcoal-2); color: #fff; font-weight: 600; }
.pager-list span { border-color: transparent; background: transparent; color: var(--muted); }

/* ---------- Alerts & toast ---------- */
.alert { border-radius: 12px; padding: 14px 18px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.alert-info { background: var(--hbl-yellow-tint); border-color: #F3DE9A; }
.alert-error { background: var(--danger-soft); border-color: #F4C7C2; color: #7A1A12; }
.alert-success { background: var(--success-soft); border-color: #BFE3CB; color: #134A27; }
.secret { font: 500 14px var(--font-mono); background: rgba(0,0,0,.06); padding: 8px 10px; border-radius: 6px; word-break: break-all; }
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--charcoal-2); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); border-left: 4px solid var(--hbl-yellow);
}
.toast-error { border-left-color: #F97066; }

/* ---------- Profile ---------- */
.profile { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.profile-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profile-name { font: 800 26px var(--font-head); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; word-break: break-word; }

/* ---------- Password / centered pages ---------- */
.center-page { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.center-card { width: 100%; max-width: 440px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.center-card h1 { font: 800 26px/1.2 var(--font-head); }
.lock-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--charcoal-2); color: var(--hbl-yellow); display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Error pages ---------- */
.error-page { display: flex; flex-direction: column; gap: 16px; max-width: 640px; padding: 24px 0; }
.error-code { font: 800 clamp(72px, 14vw, 128px)/1 var(--font-head); color: var(--charcoal-2); display: flex; align-items: center; gap: 16px; }
.error-code::before { content: ""; display: block; width: 0.32em; height: 0.75em; background: var(--hbl-yellow); transform: skewX(-14deg); }
.error-page h1 { font: 800 28px/1.2 var(--font-head); }
.error-page p { color: var(--ink-2); font-size: 17px; }

/* ---------- Guide ---------- */
.steps { display: flex; flex-direction: column; gap: 16px; counter-reset: step; }
.step { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.step h2 { font: 700 18px var(--font-head); display: flex; align-items: center; gap: 12px; }
.step h2::before {
  counter-increment: step; content: counter(step); width: 32px; height: 32px; border-radius: 8px; flex: none;
  background: var(--charcoal-2); color: var(--hbl-yellow); display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
.step img { border: 1px solid var(--line); border-radius: 10px; display: block; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: start; }

/* ---------- Logs filter ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; padding: 16px 20px; }
.filters .input { width: 220px; }
