/* =========================================================
   Stugrid — Design System (Progreel と共通)
   ========================================================= */

:root {
  --bg: #0a0a0f;
  --bg-elev: #0f0f16;
  --surface: #15151e;
  --surface-2: #1b1b26;
  --surface-3: #242432;
  --surface-glass: rgba(21, 21, 30, .72);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #f3f2f8;
  --text-2: #a6a4b9;
  --text-3: #6d6b82;
  --accent: #2ccfb6;
  --accent-strong: #1fb8a0;
  --accent-2: #ff7a45;
  --accent-soft: rgba(44,207,182,.14);
  --accent-ring: rgba(44,207,182,.45);
  --grad: linear-gradient(135deg, #14c9a8 0%, #2aa7e8 52%, #4c6fff 100%);
  --grad-soft: linear-gradient(135deg, rgba(20,201,168,.2), rgba(76,111,255,.14));
  --ok: #2fd6a0;
  --ok-soft: rgba(47, 214, 160, .14);
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, .14);
  --danger: #ff5468;
  --danger-soft: rgba(255, 84, 104, .14);
  --info: #4cb2ff;
  --info-soft: rgba(76, 178, 255, .14);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 12px 32px -12px rgba(0,0,0,.7), 0 0 0 1px var(--line);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.8), 0 0 0 1px var(--line-2);
  --r-xs: 8px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Inter", "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f4fa; --bg-elev: #fbfbfe; --surface: #ffffff; --surface-2: #f4f3f9; --surface-3: #eae8f3;
    --surface-glass: rgba(255,255,255,.78);
    --line: rgba(28, 24, 60, .08); --line-2: rgba(28, 24, 60, .15);
    --text: #17152a; --text-2: #5d5a74; --text-3: #918ea8;
    --accent: #0c9c87; --accent-strong: #08826f; --accent-soft: rgba(12,156,135,.1); --accent-ring: rgba(12,156,135,.35);
    --ok: #0fa877; --ok-soft: rgba(15,168,119,.1); --warn: #d98300; --warn-soft: rgba(217,131,0,.1);
    --danger: #e3344b; --danger-soft: rgba(227,52,75,.09); --info: #1f8fe0; --info-soft: rgba(31,143,224,.1);
    --shadow-sm: 0 1px 2px rgba(28,24,60,.06);
    --shadow: 0 10px 30px -14px rgba(28,24,60,.22), 0 0 0 1px var(--line);
    --shadow-lg: 0 30px 70px -20px rgba(28,24,60,.35), 0 0 0 1px var(--line);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f4fa; --bg-elev: #fbfbfe; --surface: #ffffff; --surface-2: #f4f3f9; --surface-3: #eae8f3;
  --surface-glass: rgba(255,255,255,.78);
  --line: rgba(28, 24, 60, .08); --line-2: rgba(28, 24, 60, .15);
  --text: #17152a; --text-2: #5d5a74; --text-3: #918ea8;
  --accent: #0c9c87; --accent-strong: #08826f; --accent-soft: rgba(12,156,135,.1); --accent-ring: rgba(12,156,135,.35);
  --ok: #0fa877; --ok-soft: rgba(15,168,119,.1); --warn: #d98300; --warn-soft: rgba(217,131,0,.1);
  --danger: #e3344b; --danger-soft: rgba(227,52,75,.09); --info: #1f8fe0; --info-soft: rgba(31,143,224,.1);
  --shadow-sm: 0 1px 2px rgba(28,24,60,.06);
  --shadow: 0 10px 30px -14px rgba(28,24,60,.22), 0 0 0 1px var(--line);
  --shadow-lg: 0 30px 70px -20px rgba(28,24,60,.35), 0 0 0 1px var(--line);
  color-scheme: light;
}

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .18s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .32s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 1;
  overflow-x: hidden;
}
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.01em; font-weight: 700; }
p { margin: 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }
.i-xl { width: 32px; height: 32px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row-sm { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

/* ---------- Shell ---------- */

.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 6px 20px -6px rgba(30,160,210,.7);
  position: relative; overflow: hidden;
}
.brand-mark svg { width: 15px; height: 15px; margin-left: 2px; }
.brand-mark::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); transform: translateX(-120%); animation: shine 6s var(--ease) infinite 2s; }
@keyframes shine { 0%, 80% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 18px 12px 6px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:active { transform: scale(.98); }
.nav-item.is-active { background: var(--accent-soft); color: var(--text); }
.nav-item.is-active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav-item.is-active .i { color: var(--accent); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent-2); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

.sidebar-projects { overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; scrollbar-width: none; }
.sidebar-projects::-webkit-scrollbar { display: none; }
.side-project { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: var(--r-sm); color: var(--text-2); font-size: 14px; transition: background .2s, color .2s; }
.side-project:hover { background: var(--surface-2); color: var(--text); }
.side-project.is-active { color: var(--text); background: var(--surface-2); }
.side-project .cover { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px 8px; border-radius: var(--r-sm); transition: background .2s; }
.user-chip:hover { background: var(--surface-2); }
.user-chip .name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.user-chip .role { font-size: 12px; color: var(--text-3); }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: var(--surface-glass);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar .brand { display: none; padding: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 14px; min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .current { color: var(--text); font-weight: 600; }

.main { flex: 1; padding: 8px 28px 64px; }
.page { max-width: 1240px; margin: 0 auto; width: 100%; }
.page-narrow { max-width: 760px; }

.tabbar { display: none; }

@media (max-width: 960px) {
  .sidebar { display: none; }
  .main-wrap { margin-left: 0; }
  .topbar { padding: 0 16px; height: 58px; }
  .topbar .brand { display: flex; font-size: 18px; }
  .topbar .crumbs { display: none; }
  .main { padding: 4px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }
  .tabbar {
    position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
    height: 62px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    background: var(--surface-glass);
    backdrop-filter: saturate(170%) blur(22px); -webkit-backdrop-filter: saturate(170%) blur(22px);
    border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow-lg);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600;
    color: var(--text-3); padding: 6px 0; position: relative; transition: color .2s;
  }
  .tab .i { width: 22px; height: 22px; transition: transform .35s var(--spring); }
  .tab.is-active { color: var(--text); }
  .tab.is-active .i { color: var(--accent); transform: translateY(-1px) scale(1.08); }
  .tab:active .i { transform: scale(.88); }
  .tab .dot { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent-2); color: #fff; font-size: 10px; display: grid; place-items: center; border: 2px solid var(--surface); }
  .tab-fab { justify-self: center; width: 50px; height: 50px; border-radius: 17px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: 0 10px 24px -8px rgba(30,160,210,.8); transition: transform .3s var(--spring); }
  .tab-fab:active { transform: scale(.9) rotate(90deg); }
  .tab-fab .i { width: 24px; height: 24px; stroke-width: 2.2; }
}

/* ---------- Page header ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 22px 0 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.025em; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
@media (max-width: 640px) {
  .page-head { padding: 14px 0 18px; }
  .page-head h1 { font-size: 24px; }
}

.section { margin-top: 36px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-head .count { font-size: 12px; font-weight: 700; color: var(--text-3); background: var(--surface-2); padding: 1px 8px; border-radius: 20px; }
.link-more { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 2px; transition: color .2s, gap .2s; }
.link-more:hover { color: var(--accent); gap: 6px; }

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-bd: var(--line-2);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px;
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  font-weight: 600; font-size: 14px; white-space: nowrap; user-select: none;
  transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .25s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-loading { opacity: .55; pointer-events: none; }
.btn .i { width: 18px; height: 18px; }
.btn-primary { --btn-fg: #fff; --btn-bd: transparent; background: var(--grad); box-shadow: 0 8px 22px -10px rgba(30,160,210,.9), inset 0 1px 0 rgba(255,255,255,.18); overflow: hidden; }
.btn-primary:hover { background: var(--grad); box-shadow: 0 12px 28px -10px rgba(30,160,210,1), inset 0 1px 0 rgba(255,255,255,.25); transform: translateY(-1px); }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 35%, rgba(255,255,255,.28) 50%, transparent 65%); transform: translateX(-100%); transition: transform .7s var(--ease); }
.btn-primary:hover::after { transform: translateX(100%); }
.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent); --btn-bd: transparent; }
.btn-soft:hover { background: rgba(44,207,182,.24); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: transparent; }
.btn-danger:hover { background: rgba(255,84,104,.22); }
.btn-ok { --btn-bg: var(--ok-soft); --btn-fg: var(--ok); --btn-bd: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn.is-loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); position: relative; transition: background .2s, color .2s, transform .2s var(--ease); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn .badge-dot { position: absolute; top: 7px; right: 7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent-2); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); animation: pop .4s var(--spring); }
@keyframes pop { from { transform: scale(0); } }

/* ---------- Cards ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-hover { transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; }
.card-hover:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }

.grid { display: grid; gap: 16px; }
.grid-projects { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid-assets { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (max-width: 640px) {
  .grid-projects { grid-template-columns: 1fr; gap: 12px; }
  .grid-assets { grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* ---------- Covers (project icons) ---------- */

.cover { --c1: #7c6cff; --c2: #c15cff; position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 14px; background: linear-gradient(135deg, var(--c1), var(--c2)); flex: none; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-icon { font-size: 1.5em; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
.cover-violet { --c1: #7c6cff; --c2: #b45cff; }
.cover-pink { --c1: #ff5e8a; --c2: #ff8f6b; }
.cover-orange { --c1: #ff8a3d; --c2: #ffc24a; }
.cover-yellow { --c1: #f5c84a; --c2: #9be15d; }
.cover-green { --c1: #23c983; --c2: #2fd6c8; }
.cover-teal { --c1: #1fb6c9; --c2: #4c8dff; }
.cover-blue { --c1: #4c6fff; --c2: #6cc2ff; }
.cover-slate { --c1: #4a4a63; --c2: #7c7a96; }

/* ---------- Project card ---------- */

.project-card { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.project-card .pc-banner { height: 112px; position: relative; border-radius: 0; font-size: 34px; }
.project-card .pc-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.35), transparent 60%); }
.project-card .pc-banner .cover-icon { transition: transform .5s var(--spring); }
.project-card:hover .pc-banner .cover-icon { transform: scale(1.15) rotate(-6deg); }
.project-card .pc-banner img { transition: transform .8s var(--ease); }
.project-card:hover .pc-banner img { transform: scale(1.06); }
.pc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.pc-title { font-size: 16px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-meta { display: flex; align-items: center; gap: 14px; color: var(--text-3); font-size: 12.5px; }
.pc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.pc-meta .i { width: 15px; height: 15px; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.pc-flag { position: absolute; top: 10px; right: 10px; z-index: 1; }

/* ---------- Progress ---------- */

.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 1.1s var(--ease); }
.bar.is-done > span { background: var(--ok); }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
.bar-row .bar { flex: 1; }

.ring { --size: 44px; width: var(--size); height: var(--size); position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring-track { stroke: var(--surface-3); }
.ring-bar { stroke: url(#ring-grad); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.ring-label { position: relative; font-weight: 800; font-size: calc(var(--size) * .26); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-label small { font-size: .6em; font-weight: 700; color: var(--text-3); margin-left: 1px; }

/* ---------- Avatars ---------- */

.avatar {
  --hue: 260; --s: 34px;
  width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: calc(var(--s) * .42); color: #fff; line-height: 1;
  background: linear-gradient(135deg, hsl(var(--hue) 80% 62%), hsl(calc(var(--hue) + 40) 85% 55%));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
  user-select: none;
}
.avatar-xs { --s: 22px; }
.avatar-sm { --s: 28px; }
.avatar-md { --s: 36px; }
.avatar-lg { --s: 48px; }
.avatar-xl { --s: 72px; }
.avatar-empty { background: var(--surface-3); color: var(--text-3); }
.avatar-empty .i { width: 55%; height: 55%; }
.avatar-more { background: var(--surface-3); color: var(--text-2); font-size: 11px; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ---------- Chips & badges ---------- */

.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip .i { width: 13px; height: 13px; }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-glass { background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.due-overdue { background: var(--danger-soft); color: var(--danger); }
.due-today { background: var(--warn-soft); color: var(--warn); animation: pulse-warn 2.4s ease-in-out infinite; }
.due-soon { background: var(--warn-soft); color: var(--warn); }
.due-later { background: var(--surface-2); color: var(--text-2); }
.due-done { background: var(--ok-soft); color: var(--ok); }
@keyframes pulse-warn { 50% { box-shadow: 0 0 0 4px rgba(255,181,71,.12); } }

.role-badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; letter-spacing: .02em; }
.role-teacher { background: rgba(255, 94, 138, .15); color: #ff6d95; }
.role-tutor { background: var(--info-soft); color: var(--info); }
.role-student { background: var(--surface-2); color: var(--text-2); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.s-todo { background: var(--text-3); }
.s-doing { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.s-pending { background: var(--text-3); box-shadow: 0 0 0 3px var(--surface-3); }
.s-done { background: var(--ok); }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 18px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.req { color: var(--accent-2); font-size: 11px; font-weight: 700; }
.opt { color: var(--text-3); font-size: 11px; font-weight: 600; }
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-grid + .hint { margin-top: 6px; }
.m-real { font-weight: 500; font-size: 13px; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  outline: none; font-size: 16px; line-height: 1.5;
  transition: border-color .2s, box-shadow .2s, background .2s;
  -webkit-appearance: none; appearance: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 96px; }
.select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input[type="date"] { min-height: 46px; }
.hint { font-size: 12.5px; color: var(--text-3); }
.error { font-size: 12.5px; color: var(--danger); display: flex; align-items: center; gap: 5px; animation: shake .4s; }
.has-error .input, .has-error .textarea { border-color: var(--danger); }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.input-group { position: relative; }
.input-group .input { padding-left: 42px; }
.input-group > .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; transition: color .2s; }
.input-group:focus-within > .i { color: var(--accent); }
.input-group .toggle-pass { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .field + .field { margin-top: 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch-track { width: 44px; height: 26px; border-radius: 13px; background: var(--surface-3); position: relative; transition: background .25s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .35s var(--spring); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--accent-soft); }

.segmented { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; position: relative; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented a, .segmented button, .segmented label { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: color .25s; cursor: pointer; }
.segmented a:hover, .segmented button:hover, .segmented label:hover { color: var(--text); }
.segmented .is-active, .segmented input:checked + span { color: var(--text); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.seg-indicator { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); transition: transform .45s var(--spring), width .45s var(--spring); }
.segmented .count { font-size: 11px; background: var(--surface-3); color: var(--text-2); padding: 0 6px; border-radius: 8px; min-width: 18px; text-align: center; }

.role-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-option { position: relative; cursor: pointer; }
.role-option input { position: absolute; opacity: 0; }
.role-option span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--text-2); transition: all .25s var(--ease); }
.role-option span b { font-size: 22px; transition: transform .35s var(--spring); }
.role-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.role-option input:checked + span b { transform: scale(1.18); }

.icon-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.icon-picker label { position: relative; cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; }
.icon-picker span { aspect-ratio: 1; display: grid; place-items: center; font-size: 22px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; transition: transform .3s var(--spring), border-color .2s, background .2s; }
.icon-picker label:hover span { transform: scale(1.08); }
.icon-picker input:checked + span { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }
.color-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.color-picker label { cursor: pointer; position: relative; }
.color-picker input { position: absolute; opacity: 0; }
.color-picker .cover { width: 34px; height: 34px; border-radius: 50%; transition: transform .3s var(--spring), box-shadow .2s; }
.color-picker input:checked + .cover { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); transform: scale(1.08); }
@media (max-width: 480px) { .icon-picker { grid-template-columns: repeat(6, 1fr); } }

.cover-preview { display: flex; gap: 18px; align-items: center; }
.cover-preview .cover { width: 96px; height: 96px; border-radius: 24px; font-size: 40px; transition: background .4s; }
.thumb-upload { display: inline-flex; flex-direction: column; gap: 8px; }

/* ---------- Member picker ---------- */

.picker { position: relative; }
.picker-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 300px; overflow-y: auto; animation: drop-in .25s var(--ease); }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; width: 100%; text-align: left; }
.picker-item:hover, .picker-item.is-focus { background: var(--surface-2); }
.picker-item[disabled] { opacity: .45; cursor: default; }
.picker-item .uname { font-size: 12px; color: var(--text-3); }
.picker-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 13px; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.picker-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 6px 4px 4px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; animation: pop .35s var(--spring); }
.picker-chip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); }
.picker-chip button:hover { background: var(--surface-3); color: var(--text); }
.picker-chip .i { width: 13px; height: 13px; }
.picker-chip .note { font-size: 11px; color: var(--text-3); font-weight: 500; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------- Empty state ---------- */

.empty { text-align: center; padding: 56px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); color: var(--text-2); }
.empty-art { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 26px; display: grid; place-items: center; background: var(--grad-soft); color: var(--accent); position: relative; animation: float 5s ease-in-out infinite; }
.empty-art .i { width: 38px; height: 38px; stroke-width: 1.5; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 20px; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-3deg); } }

/* ---------- Alerts / banners ---------- */

.banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--r); background: var(--grad-soft); border: 1px solid rgba(44,207,182,.25); }
.banner .i { color: var(--accent); }
.banner-warn { background: var(--warn-soft); border-color: rgba(255,181,71,.25); }
.banner-warn .i { color: var(--warn); }
.banner p { flex: 1; font-size: 14px; }
@media (max-width: 640px) { .banner { flex-wrap: wrap; } .banner .btn { width: 100%; } }

/* ---------- Toasts ---------- */

.toasts { position: fixed; z-index: 200; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: toast-in .5s var(--spring) both; max-width: 100%; }
.toast.is-leaving { animation: toast-out .3s var(--ease) both; }
.toast .t-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.toast-success .t-icon { background: var(--ok-soft); color: var(--ok); }
.toast-error .t-icon { background: var(--danger-soft); color: var(--danger); }
.toast-info .t-icon { background: var(--accent-soft); color: var(--accent); }
.toast .i { width: 16px; height: 16px; stroke-width: 2.4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(.92); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.95); } }

/* ---------- Modal / Sheet ---------- */

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 10, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade-in .3s var(--ease) both; }
.modal-panel { position: relative; width: min(100%, 540px); max-height: calc(100dvh - 40px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: modal-in .45s var(--spring) both; overscroll-behavior: contain; }
.modal-panel.wide { width: min(100%, 720px); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; background: var(--surface); }
.modal-head h3 { font-size: 18px; flex: 1; }
.modal-body { padding: 4px 20px 20px; }
.modal-foot { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px 18px; background: var(--surface); border-top: 1px solid var(--line); }
.modal.is-closing .modal-backdrop { animation: fade-out .25s var(--ease) both; }
.modal.is-closing .modal-panel { animation: modal-out .25s var(--ease) both; }
.sheet-grip { display: none; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(.96); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@media (max-width: 640px) {
  .modal { place-items: end stretch; padding: 0; }
  .modal-panel, .modal-panel.wide { width: 100%; max-height: 92dvh; border-radius: 26px 26px 0 0; border-bottom: 0; animation: sheet-in .5s var(--spring) both; padding-bottom: var(--safe-b); }
  .modal.is-closing .modal-panel { animation: sheet-out .3s var(--ease) both; }
  .sheet-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 10px auto 0; }
  .modal-head { padding-top: 10px; }
  .modal-foot .btn { flex: 1; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }
}

/* ---------- Dropdown menu ---------- */

.menu-wrap { position: relative; }
.menu { position: absolute; z-index: 60; right: 0; top: calc(100% + 6px); min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg); transform-origin: top right; animation: menu-in .3s var(--spring) both; }
.menu.menu-up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--text); text-align: left; transition: background .15s; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .i { width: 17px; height: 17px; color: var(--text-2); }
.menu-item.danger, .menu-item.danger .i { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
@keyframes menu-in { from { opacity: 0; transform: scale(.92) translateY(-4px); } }

/* ---------- Reveal animations ---------- */

.reveal > * { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 40ms); }
.rise { animation: rise .6s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Guest (auth)
   ========================================================= */

.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art { position: relative; overflow: hidden; background: #08070d; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; color: #fff; isolation: isolate; }
.auth-art .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .75; z-index: -1; animation: blob 18s ease-in-out infinite; }
.auth-art .b1 { width: 460px; height: 460px; background: #14c9a8; top: -120px; left: -80px; }
.auth-art .b2 { width: 380px; height: 380px; background: #4c6fff; bottom: -100px; right: -60px; animation-delay: -6s; }
.auth-art .b3 { width: 300px; height: 300px; background: #ff7a45; top: 40%; left: 40%; opacity: .35; animation-delay: -12s; }
@keyframes blob { 33% { transform: translate(60px, 40px) scale(1.1); } 66% { transform: translate(-40px, 60px) scale(.92); } }
.auth-art .grain { position: absolute; inset: 0; z-index: -1; opacity: .18; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E"); mix-blend-mode: overlay; }
.auth-art .brand { color: #fff; padding: 0; }
.auth-copy h2 { font-size: clamp(34px, 4vw, 54px); font-weight: 800; letter-spacing: -.035em; line-height: 1.12; }
.auth-copy p { margin-top: 16px; font-size: 16px; opacity: .78; max-width: 420px; line-height: 1.8; }
.reel { display: flex; gap: 12px; margin: 40px -60px 0 0; transform: rotate(-6deg); }
.reel-strip { display: flex; gap: 12px; animation: reel 28s linear infinite; }
.reel-frame { width: 150px; height: 96px; border-radius: 14px; flex: none; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(10px); display: grid; place-items: center; font-size: 30px; position: relative; overflow: hidden; }
.reel-frame::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.15), transparent 60%); }
.reel-frame .pin { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #ff5e8a; border: 2px solid #fff; top: 22%; left: 64%; box-shadow: 0 0 0 6px rgba(255,94,138,.25); animation: ping 2s ease-out infinite; }
@keyframes reel { to { transform: translateX(calc(-50% - 6px)); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255,94,138,.6); } 100% { box-shadow: 0 0 0 14px rgba(255,94,138,0); } }
.auth-foot { font-size: 13px; opacity: .55; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 410px; animation: rise .7s var(--ease) both; }
.auth-card h1 { font-size: 28px; font-weight: 800; letter-spacing: -.025em; }
.auth-card .lead { color: var(--text-2); margin: 8px 0 28px; }
.auth-switch { margin-top: 24px; text-align: center; font-size: 14px; color: var(--text-2); }
.auth-switch a { color: var(--accent); font-weight: 600; }
.auth-mobile-brand { display: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { align-items: flex-start; padding: 28px 20px 40px; position: relative; overflow: hidden; }
  .auth-panel::before { content: ""; position: absolute; width: 420px; height: 420px; top: -260px; right: -160px; border-radius: 50%; background: var(--grad); filter: blur(80px); opacity: .35; pointer-events: none; }
  .auth-mobile-brand { display: flex; margin-bottom: 36px; }
  .auth-mobile-brand .brand { padding: 0; }
}

/* =========================================================
   Dashboard
   ========================================================= */

.hero { position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 30px 32px; background: var(--surface); border: 1px solid var(--line); isolation: isolate; }
.hero::before { content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; right: -140px; top: -280px; border-radius: 50%; background: var(--grad); filter: blur(90px); opacity: .32; animation: blob 20s ease-in-out infinite; }
.hero::after { content: ""; position: absolute; z-index: -1; width: 300px; height: 300px; left: 30%; bottom: -220px; border-radius: 50%; background: #2fd6c8; filter: blur(90px); opacity: .14; }
.hero-date { color: var(--text-2); font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.hero-stats { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; border-radius: 16px; background: var(--surface-glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-width: 150px; transition: transform .3s var(--ease), border-color .3s; }
.stat:hover { transform: translateY(-2px); border-color: var(--line-2); }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.stat-num { font-size: 24px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 3px; }
@media (max-width: 640px) {
  .hero { padding: 22px 20px; border-radius: 22px; }
  .hero h1 { font-size: 23px; }
  .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
  .stat { flex-direction: column; align-items: flex-start; min-width: 0; padding: 12px; gap: 10px; }
  .stat-icon { width: 32px; height: 32px; border-radius: 10px; }
  .stat-icon .i { width: 17px; height: 17px; }
  .stat-num { font-size: 21px; }
  .stat-label { font-size: 11px; }
}

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
@media (max-width: 1100px) { .dash-grid, .dash-grid[style] { grid-template-columns: minmax(0, 1fr) !important; } }
@media (min-width: 961px) {
  .dash-grid .hscroll { margin: 0 -4px; padding: 4px 4px 12px; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
}

.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -28px; padding: 4px 28px 12px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }
@media (max-width: 960px) { .hscroll { margin: 0 -16px; padding: 4px 16px 12px; scroll-padding: 16px; } }

.task-tile { width: 250px; padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.task-tile .tt-project { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.task-tile .tt-project .cover { width: 20px; height: 20px; border-radius: 6px; font-size: 11px; }
.task-tile h4 { font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; transition: background .2s; }
.list-item:hover { background: var(--surface-2); }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 14px; }
.list-item .li-sub { font-size: 12.5px; color: var(--text-3); }
.thumb-sm { width: 56px; height: 40px; border-radius: 9px; overflow: hidden; flex: none; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================================
   Project detail
   ========================================================= */

.project-hero { position: relative; border-radius: var(--r-xl); overflow: hidden; margin-top: 12px; isolation: isolate; border: 1px solid var(--line); }
.project-hero .ph-bg { position: absolute; inset: 0; z-index: -2; border-radius: 0; }
.project-hero .ph-bg .cover-icon { display: none; }
.project-hero .ph-bg img { filter: blur(40px) saturate(1.4); transform: scale(1.3); opacity: .8; }
.project-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10,10,15,.15), rgba(10,10,15,.75)); }
.ph-inner { display: flex; align-items: flex-end; gap: 22px; padding: 34px 30px 26px; color: #fff; }
.ph-inner .cover { width: 92px; height: 92px; border-radius: 24px; font-size: 42px; box-shadow: 0 16px 40px -10px rgba(0,0,0,.6), 0 0 0 3px rgba(255,255,255,.18); }
.ph-text { flex: 1; min-width: 0; }
.ph-text h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; text-shadow: 0 2px 20px rgba(0,0,0,.3); }
.ph-text p { opacity: .82; margin-top: 6px; font-size: 14px; max-width: 640px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ph-meta { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; font-size: 13px; }
.ph-meta .chip { background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(8px); }
.ph-meta .avatar-stack .avatar { box-shadow: 0 0 0 2px rgba(20,20,30,.6); }
.ph-side { display: flex; align-items: center; gap: 14px; }
.ph-side .ring-track { stroke: rgba(255,255,255,.18); }
.ph-side .ring-label small { color: rgba(255,255,255,.6); }
.ph-actions { display: flex; gap: 8px; }
.ph-actions .btn:not(.btn-primary) { --btn-bg: rgba(255,255,255,.12); --btn-fg: #fff; --btn-bd: rgba(255,255,255,.16); backdrop-filter: blur(10px); }
@media (max-width: 760px) {
  .project-hero { margin: 4px -16px 0; border-radius: 0 0 26px 26px; border: 0; }
  .ph-inner { position: relative; flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px 20px 20px; }
  .ph-inner .cover { width: 60px; height: 60px; border-radius: 17px; font-size: 28px; }
  .ph-text h1 { font-size: 22px; }
  .ph-side { position: absolute; top: 22px; right: 20px; flex-direction: row-reverse; gap: 10px; }
  .ph-side .ring { --size: 54px !important; }
  /* ボタンが3つ以上あるときは、進捗リングだけ右上に残してボタンは下に並べる */
  .ph-side:has(.ph-actions > :nth-child(3)) { display: contents; }
  .ph-side:has(.ph-actions > :nth-child(3)) .ring { position: absolute; top: 22px; right: 20px; }
  .ph-side:has(.ph-actions > :nth-child(3)) .ph-actions { flex-wrap: wrap; }
}

.tabs-bar { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 0; margin-top: 8px; background: linear-gradient(var(--bg) 70%, transparent); }
@media (max-width: 960px) { .tabs-bar { top: 58px; } }
.tab-panel { animation: rise .5s var(--ease) both; }

/* Dropzone */
.dropzone { position: relative; display: flex; align-items: center; gap: 18px; padding: 22px 24px; border-radius: var(--r-lg); border: 1.5px dashed var(--line-2); background: var(--surface); cursor: pointer; transition: border-color .25s, background .25s, transform .35s var(--spring); overflow: hidden; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-over { border-color: var(--accent); border-style: solid; background: var(--accent-soft); transform: scale(1.01); }
.dropzone .dz-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; box-shadow: 0 10px 24px -10px rgba(30,160,210,.9); transition: transform .4s var(--spring); }
.dropzone:hover .dz-icon, .dropzone.is-over .dz-icon { transform: translateY(-3px) rotate(-6deg); }
.dropzone .dz-icon .i { width: 26px; height: 26px; }
.dropzone h4 { font-size: 15px; }
.dropzone p { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.dropzone input { display: none; }
.drop-overlay { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: rgba(10,10,20,.72); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.drop-overlay.is-active { opacity: 1; }
.drop-overlay .do-box { padding: 48px 64px; border-radius: 30px; border: 2px dashed var(--accent); text-align: center; color: #fff; transform: scale(.9); transition: transform .4s var(--spring); }
.drop-overlay.is-active .do-box { transform: scale(1); }
.drop-overlay .dz-icon { margin: 0 auto 14px; width: 70px; height: 70px; border-radius: 22px; display: grid; place-items: center; background: var(--grad); }
@media (max-width: 640px) { .dropzone { padding: 16px; gap: 14px; } .dropzone .dz-icon { width: 46px; height: 46px; border-radius: 14px; } }

.upload-queue { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.upload-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); animation: rise .4s var(--ease) both; }
.upload-item .ui-thumb { width: 64px; height: 44px; border-radius: 10px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; flex: none; color: var(--text-3); }
.upload-item .ui-thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload-item .ui-body { flex: 1; min-width: 0; }
.upload-item .ui-name { font-weight: 600; font-size: 14px; }
.upload-item .ui-status { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; margin-top: 2px; }
.upload-item .bar { margin-top: 8px; height: 5px; }
.upload-item .bar > span { transition: width .3s linear; }
.upload-item.is-done .bar > span { background: var(--ok); }
.upload-item.is-error { border-color: rgba(255,84,104,.4); }
.upload-item.is-error .ui-status { color: var(--danger); }

/* Asset card */
.asset-card { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.asset-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; display: grid; place-items: center; color: var(--text-3); }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.asset-card:hover .asset-thumb img { transform: scale(1.05); }
.asset-thumb .play { position: absolute; width: 48px; height: 48px; border-radius: 50%; background: rgba(0,0,0,.5); backdrop-filter: blur(8px); color: #fff; display: grid; place-items: center; opacity: 0; transform: scale(.8); transition: all .35s var(--spring); }
.asset-thumb .play .i { margin-left: 3px; }
.asset-card:hover .asset-thumb .play { opacity: 1; transform: scale(1); }
.asset-thumb .tl { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.asset-thumb .br { position: absolute; bottom: 8px; right: 8px; }
.asset-thumb .fallback { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.asset-thumb .fallback .i { width: 34px; height: 34px; stroke-width: 1.4; }
.asset-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.asset-title { font-weight: 600; font-size: 14px; line-height: 1.4; }
.asset-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.asset-meta .stat-inline { display: inline-flex; align-items: center; gap: 3px; }
.asset-meta .i { width: 14px; height: 14px; }
.expiry { font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); }
.expiry.is-soon { color: var(--warn); }
@media (max-width: 640px) {
  .asset-body { padding: 10px 10px 12px; gap: 6px; }
  .asset-title { font-size: 13px; }
  .asset-meta { font-size: 11px; flex-wrap: wrap; gap: 6px; }
}

/* Kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.column { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; min-height: 140px; transition: background .25s, border-color .25s; }
.column.is-over { background: var(--accent-soft); border-color: var(--accent-ring); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 12px; font-weight: 700; font-size: 14px; }
.column-head .count { font-size: 12px; color: var(--text-3); font-weight: 600; }
.column-head .add { margin-left: auto; }
.column-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.task-card { position: relative; padding: 13px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s, border-color .2s, opacity .2s; user-select: none; }
.task-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.task-card.is-dragging { opacity: .4; transform: rotate(2deg) scale(.98); }
.task-card.is-new { animation: pop-in .5s var(--spring) both; }
.task-card h5 { font-size: 14px; font-weight: 600; line-height: 1.45; margin: 0 0 10px; }
.task-card .tc-foot { display: flex; align-items: center; gap: 8px; }
.task-card .tc-foot .spacer { flex: 1; }
.task-card .bar { margin-top: 10px; height: 4px; }
.task-card.is-done h5 { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.drop-placeholder { height: 4px; border-radius: 2px; background: var(--accent); margin: -2px 0; box-shadow: 0 0 12px var(--accent); }
@keyframes pop-in { from { opacity: 0; transform: scale(.9); } }
@media (max-width: 960px) {
  .board { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 8px; gap: 10px; scrollbar-width: none; scroll-padding: 16px; }
  .board::-webkit-scrollbar { display: none; }
  .column { flex: none; width: 82vw; max-width: 340px; scroll-snap-align: start; }
}
.board-dots { display: none; justify-content: center; gap: 6px; margin-top: 4px; }
@media (max-width: 960px) { .board-dots { display: flex; } }
.board-dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--line-2); transition: width .35s var(--spring), background .25s; }
.board-dots span.is-active { width: 18px; background: var(--accent); }

/* Member list */
.member-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.member-row + .member-row { border-top: 1px solid var(--line); }
.member-row .m-body { flex: 1; min-width: 0; }
.member-row .m-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.member-row .m-sub { font-size: 12.5px; color: var(--text-3); }

/* Task detail */
.progress-input { display: flex; align-items: center; gap: 16px; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--val, 0%), var(--surface-3) var(--val, 0%)); outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 10px rgba(0,0,0,.35), 0 0 0 5px var(--accent-soft); cursor: grab; transition: transform .25s var(--spring); }
.range::-webkit-slider-thumb:active { transform: scale(1.15); cursor: grabbing; }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.progress-value { font-size: 28px; font-weight: 800; min-width: 76px; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.progress-steps { display: flex; gap: 6px; margin-top: 10px; }
.progress-steps button { flex: 1; height: 30px; border-radius: 8px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-2); transition: background .2s, color .2s; }
.progress-steps button:hover { background: var(--surface-3); color: var(--text); }
.status-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.status-picker label { position: relative; cursor: pointer; }
.status-picker input { position: absolute; opacity: 0; }
.status-picker label > span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; transition: all .2s; }
.status-picker input:checked + span { background: var(--surface); transform: translateY(-1px); border-color: var(--line-2); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 480px) { .status-picker label > span { font-size: 12px; } }
.status-picker input:checked + span .status-dot { animation: pop .35s var(--spring); }
.status-picker input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline { position: relative; display: flex; flex-direction: column; gap: 14px; padding-left: 4px; }
.timeline-item { display: flex; gap: 12px; font-size: 13.5px; position: relative; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 32px; bottom: -14px; width: 2px; background: var(--line); }
.timeline-item .tl-body { flex: 1; min-width: 0; padding-top: 3px; }
.timeline-item .tl-note { margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); white-space: pre-wrap; word-break: break-word; }

/* Task list page */
.task-group { margin-top: 26px; }
.task-group h3 { font-size: 13px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; margin-bottom: 10px; letter-spacing: .02em; }
.task-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
.task-row + .task-row { border-top: 1px solid var(--line); }
.task-row:hover { background: var(--surface-2); }
.task-row:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.task-row:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.task-row:only-child { border-radius: var(--r-lg); }
.task-row .tr-body { flex: 1; min-width: 0; }
.task-row .tr-title { font-weight: 600; font-size: 14.5px; }
.task-row .tr-sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.task-row .tr-sub .cover { width: 16px; height: 16px; border-radius: 5px; font-size: 9px; }
.check-btn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; transition: all .3s var(--spring); }
.check-btn:hover { border-color: var(--ok); color: var(--ok); }
.check-btn.is-checked { background: var(--ok); border-color: var(--ok); color: #fff; transform: scale(1.1); }
.check-btn .i { width: 14px; height: 14px; stroke-width: 3; }

/* Notifications */
.notif { display: flex; gap: 14px; padding: 16px 18px; position: relative; transition: background .2s; }
.notif + .notif { border-top: 1px solid var(--line); }
.notif:hover { background: var(--surface-2); }
.notif.is-unread::before { content: ""; position: absolute; left: 6px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 3px rgba(255,94,138,.2); }
.notif-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 14.5px; line-height: 1.5; }
.notif.is-read .notif-title { font-weight: 500; color: var(--text-2); }
.notif-text { font-size: 13px; color: var(--text-2); white-space: pre-line; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notif-time { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.ni-question, .ni-answer, .ni-mention { background: rgba(255,94,138,.14); color: #ff6d95; }
.ni-invite, .ni-member_added, .ni-member_joined, .ni-signup_request, .ni-signup_approved { background: var(--accent-soft); color: var(--accent); }
.ni-reminder, .ni-expiry { background: var(--warn-soft); color: var(--warn); }
.ni-task_assigned, .ni-task_review, .ni-task_changed, .ni-task_unassigned { background: var(--info-soft); color: var(--info); }
.ni-comment, .ni-reply, .ni-asset_uploaded, .ni-submitted, .ni-assignment_approved { background: var(--ok-soft); color: var(--ok); }
.ni-assignment_request { background: var(--accent-soft); color: var(--accent); }
.ni-assignment_rejected { background: var(--warn-soft); color: var(--warn); }

/* Profile */
.settings-card { padding: 24px; }
.settings-card h2 { font-size: 17px; margin-bottom: 4px; }
.settings-card > .muted { font-size: 13.5px; margin-bottom: 20px; }
.hue-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.hue-picker label { cursor: pointer; position: relative; }
.hue-picker input { position: absolute; opacity: 0; }
.hue-picker .avatar { transition: transform .3s var(--spring), box-shadow .2s; }
.hue-picker input:checked + .avatar { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); transform: scale(1.1); }
.profile-head { display: flex; align-items: center; gap: 18px; padding: 24px; }

.loader { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-2); font-size: 14px; }
.loader-spin { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* Lightweight skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* Error page */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 40px 20px; }
.error-code { font-size: 96px; font-weight: 900; letter-spacing: -.05em; line-height: 1; }

/* プロフィール画像（元画像を切り抜き範囲で丸く表示） */
.avatar.has-img { background-color: var(--surface-3); background-repeat: no-repeat; color: transparent; }
.avatar-xl { --s: 84px; }
.cropper { position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: 4px auto 0; overflow: hidden; border-radius: 18px; background: #000; touch-action: none; cursor: grab; user-select: none; }
.cropper:active { cursor: grabbing; }
.cropper img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; pointer-events: none; }
.crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.55); outline: 2px solid rgba(255,255,255,.85); outline-offset: -2px; pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 10px; margin: 18px auto 0; width: min(100%, 320px); color: var(--text-3); }

/* コメントの並び順 */
.panel-sub { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.segmented-sm { padding: 3px; border-radius: 11px; }
.segmented-sm button { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.segmented-sm .seg-indicator { top: 3px; bottom: 3px; border-radius: 8px; }
.segmented-sm .i { width: 13px; height: 13px; }

/* サイドバー: プロジェクト作成ボタン（プロジェクト名と見間違えないよう点線のボタンに） */
.side-new { display: flex; align-items: center; gap: 10px; margin: 8px 6px 4px; padding: 8px 12px; border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); color: var(--text-2); font-size: 13.5px; font-weight: 600; transition: border-color .2s, color .2s, background .2s; }
.side-new:hover { border-color: var(--accent); border-style: solid; color: var(--accent); background: var(--accent-soft); }
.side-new-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.side-new-icon .i { width: 14px; height: 14px; stroke-width: 2.6; }

/* ユーザー管理 */
.user-row { transition: background .2s; }
.user-row:hover { background: var(--surface-2); }
.user-meta { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.user-meta span { display: inline-flex; align-items: center; gap: 5px; }
.chip-cover { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; }
.role-badge { white-space: nowrap; }
@media (max-width: 640px) {
  .user-meta { display: none; }
  .user-row .m-name { flex-wrap: wrap; }
}
/* 組織の表示 */
.org-badge { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 22px; padding: 8px 16px 8px 8px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.org-badge-thumb { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 18px; flex: none; }
.org-badge-thumb img { width: 100%; height: 100%; object-fit: cover; }
.org-badge-name { font-weight: 700; font-size: 15px; }
.side-org { display: flex; align-items: center; gap: 10px; margin: -6px 4px 12px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.side-org .org-badge-thumb { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.side-org-name { font-size: 13px; font-weight: 700; min-width: 0; }
.side-org-label { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; }
.org-card { display: flex; flex-direction: column; }
.org-card-main { display: flex; align-items: center; gap: 14px; padding: 18px 18px 12px; }
.org-card-thumb { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; }
.org-card-name { display: block; font-weight: 700; font-size: 16px; }

@media (max-width: 960px) { .tabbar.tabbar-3 { grid-template-columns: repeat(3, 1fr); } }
.role-admin { background: rgba(255,181,71,.16); color: var(--warn); }

/* 登録の案内（リンク・コード） */
.share-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.share-label { display: inline-flex; align-items: center; gap: 6px; width: 150px; font-size: 13px; font-weight: 600; color: var(--text-2); flex: none; }
.share-label .i { width: 15px; height: 15px; }
.share-value { flex: 1; min-width: 160px; padding: 7px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; overflow-wrap: anywhere; user-select: all; }
.share-code { font-size: 16px; font-weight: 700; letter-spacing: .12em; }
@media (max-width: 640px) { .share-label { width: 100%; } }

.pending-card { border-color: rgba(255,181,71,.35); }
.pending-card .member-row + .member-row { border-top: 1px solid var(--line); }

/* メールアドレス未登録 */
.no-email-body { padding-top: 24px; }
.no-email-body h3 { font-size: 17px; text-align: center; margin-bottom: 6px; }
.no-email-body > p.muted { text-align: center; }
.no-email-art { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px; background: var(--warn-soft); color: var(--warn); }
.no-email-list { list-style: none; margin: 16px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.no-email-list li { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.no-email-list li > span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); flex: none; }
.no-email-list b { display: block; font-size: 14px; }
.no-email-list small { display: block; font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin-top: 2px; }
.no-email { color: var(--warn); font-weight: 600; }
.forgot-note { display: flex; gap: 6px; margin-top: 18px; line-height: 1.6; }
.forgot-note .i { flex: none; margin-top: 3px; }
.no-email-body + .modal-foot .btn { flex: 1; }

/* フッター（コピーライト） */
.site-foot { margin-top: 48px; padding: 18px 0 4px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; color: var(--text-3); letter-spacing: .02em; }
.is-review .site-foot { display: none; }
.auth-copyright { border-top: 0; margin-top: 32px; }
@media (min-width: 901px) { .auth-copyright { margin-top: 40px; } }
.site-foot a, .auth-foot a { color: inherit; text-decoration: none; transition: color .2s; }
.site-foot a:hover, .auth-foot a:hover { color: var(--accent); text-decoration: underline; }


/* =========================================================
   Stugrid
   ========================================================= */

.hide-sm { display: inline; }
@media (max-width: 640px) { .hide-sm { display: none; } }
.flip { transform: rotate(180deg); }
.chip-lg { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.chip-lg .i { width: 15px; height: 15px; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.input-group > .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; }
.input-group > .icon-btn:active { transform: translateY(-50%) scale(.92); }
.input-group:has(> .icon-btn) .input { padding-right: 48px; }
.select-sm { min-height: 34px; height: 34px; padding: 4px 32px 4px 10px; font-size: 13px; border-radius: 9px; background-position: right 10px center; width: auto; }
.nav-badge-soft { background: var(--surface-3); color: var(--text-2); }
.org-badge-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* サイドバー: 貸し出し・返却ボタン */
.side-desk { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 2px 14px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff; font-weight: 700; box-shadow: 0 10px 24px -12px rgba(30,160,210,.9), inset 0 1px 0 rgba(255,255,255,.2); transition: transform .2s var(--ease), box-shadow .25s; }
.side-desk:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(30,160,210,1); }
.side-desk:active { transform: scale(.98); }

/* アプリの切り替え（Progreel） */
.app-mark { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.app-mark .i { width: 11px; height: 11px; margin-left: 1px; }
.app-mark-progreel { background: linear-gradient(135deg, #7c6cff 0%, #b45cff 48%, #ff5e8a 100%); box-shadow: 0 4px 12px -4px rgba(180,92,255,.7); }
.app-switch { gap: 10px; }
.app-switch-sub { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.app-switch-ext { margin-left: auto; opacity: .5; }
.topbar-app { display: none; }
@media (max-width: 960px) { .topbar-app { display: grid; } }
.sso-btn { gap: 12px; border-color: var(--line-2); }
.sso-btn .app-mark { width: 26px; height: 26px; }

/* ログイン画面のイラスト */
.gear-grid { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 40px; max-width: 520px; }
.gear-cell { position: relative; aspect-ratio: 1; border-radius: 18px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.13); backdrop-filter: blur(10px); display: grid; place-items: center; font-size: 34px; animation: rise .8s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 200ms); }
.gear-code { position: absolute; bottom: 7px; left: 0; right: 0; text-align: center; font: 600 9.5px var(--mono); font-style: normal; letter-spacing: .06em; opacity: .55; }
.gear-scan { position: absolute; left: -10px; right: -10px; height: 2px; top: 0; background: linear-gradient(90deg, transparent, #2fe0c0, transparent); box-shadow: 0 0 18px 2px rgba(47,224,192,.7); animation: gear-scan 3.6s ease-in-out infinite; }
@keyframes gear-scan { 0%, 100% { top: 4%; } 50% { top: 94%; } }

/* ホーム: 貸し出し・返却 */
.desk-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.desk-cta-btn { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.desk-cta-btn:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow); }
.desk-cta-btn > span:nth-child(2) { flex: 1; min-width: 0; }
.desk-cta-btn b { display: block; font-size: 18px; }
.desk-cta-btn small { display: block; color: var(--text-2); font-size: 12.5px; }
.desk-cta-btn > .i { color: var(--text-3); }
.desk-cta-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; flex: none; }
.is-lend .desk-cta-icon, .mode-card.is-lend .mode-icon { background: var(--grad); box-shadow: 0 10px 24px -10px rgba(30,160,210,.9); }
.is-return .desk-cta-icon, .mode-card.is-return .mode-icon { background: linear-gradient(135deg, #ff9a3d, #ff6a5c); box-shadow: 0 10px 24px -10px rgba(255,120,80,.8); }
@media (max-width: 640px) {
  .desk-cta { gap: 10px; }
  .desk-cta-btn { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
  .desk-cta-btn > .i { display: none; }
  .desk-cta-icon { width: 44px; height: 44px; border-radius: 14px; }
  .desk-cta-btn b { font-size: 16px; }
}
.howto ol, .howto ul { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; }
.howto ul { list-style: none; padding: 0; }
.howto ul li { display: flex; gap: 10px; align-items: flex-start; }
.howto ul li .i { margin-top: 3px; color: var(--accent); }

/* 物品のサムネイル */
.item-thumb { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; flex: none; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-thumb.is-text { background: var(--surface-2); color: var(--ok); width: 32px; height: 32px; border-radius: 10px; margin: 0 8px; }
.item-thumb-sm { width: 32px; height: 32px; border-radius: 9px; }

/* 一覧の絞り込み */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-search { flex: 1 1 320px; }
.filter-bar .select { flex: 0 1 220px; }
@media (max-width: 640px) { .filter-bar .select { flex: 1 1 140px; } }
.chip-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 14px 0 20px; padding-bottom: 2px; scrollbar-width: none; }
.chip-tabs::-webkit-scrollbar { display: none; }
.chip-tab { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 13px; border-radius: 16px; font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; transition: all .2s var(--ease); }
.chip-tab:hover { color: var(--text); border-color: var(--line-2); }
.chip-tab.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-ring); }
.chip-tab.is-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* 物品カード */
.grid-items { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 640px) { .grid-items { grid-template-columns: 1fr 1fr; gap: 10px; } }
.item-card { display: flex; flex-direction: column; overflow: hidden; }
.item-card-img { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); overflow: hidden; }
.item-card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.item-card:hover .item-card-img img { transform: scale(1.05); }
.item-card-state { position: absolute; left: 8px; top: 8px; }
.item-card-state.is-available .state-dot { background: #3ee6a8; box-shadow: 0 0 0 3px rgba(62,230,168,.25); }
.item-card-state.is-on_loan .state-dot { background: #5cc2ff; }
.item-card-state.is-repair .state-dot { background: #ffb547; }
.item-card-state.is-lost .state-dot { background: #ff5468; }
.item-card-state.is-not_loanable .state-dot, .item-card-state.is-retired .state-dot { background: #aaa; }
.item-card-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 14px; flex: 1; }
.item-card-code { font-size: 11.5px; color: var(--text-3); letter-spacing: .03em; }
.item-card-name { font-weight: 700; font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card-sub { font-size: 12.5px; color: var(--text-2); }
.item-card-foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
@media (max-width: 640px) {
  .item-card-body { padding: 10px 10px 12px; }
  .item-card-name { font-size: 13.5px; }
  .item-card-state { font-size: 10.5px; height: 22px; padding: 0 7px; }
}

/* 物品の詳細 */
.item-hero { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 28px; margin-top: 18px; align-items: start; }
@media (max-width: 860px) { .item-hero { grid-template-columns: 1fr; gap: 18px; } }
.gallery-main { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: #000; cursor: zoom-in; }
.gallery-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-3); }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; }
.gallery-thumb { width: 72px; height: 54px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; opacity: .65; transition: opacity .2s, border-color .2s; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb.is-active { border-color: var(--accent); opacity: 1; }
.code-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; letter-spacing: .03em; }
.code-pill:hover { border-color: var(--accent); color: var(--accent); }
.item-title { font-size: 30px; font-weight: 800; letter-spacing: -.025em; margin-top: 12px; line-height: 1.3; }
@media (max-width: 640px) { .item-title { font-size: 24px; } }
.parent-link { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--text); font-size: 14px; border: 1px solid var(--accent-ring); transition: transform .2s var(--ease); }
.parent-link:hover { transform: translateX(2px); }
.parent-link > .i:first-child { color: var(--accent); }
.parent-link > span:nth-child(2) { flex: 1; min-width: 0; }
.loan-box { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 14px 16px; border-radius: 16px; background: var(--info-soft); border: 1px solid rgba(76,178,255,.25); flex-wrap: wrap; }
.item-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; align-items: center; }
.item-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
@media (max-width: 1000px) { .item-grid { grid-template-columns: minmax(0, 1fr); gap: 0; } }
.spec { margin: 0; padding: 6px 18px; }
.spec > div { display: flex; gap: 16px; padding: 11px 0; font-size: 14px; }
.spec > div + div { border-top: 1px solid var(--line); }
.spec dt { width: 120px; flex: none; color: var(--text-3); font-size: 13px; padding-top: 1px; }
.spec dd { margin: 0; flex: 1; min-width: 0; word-break: break-word; }
.spec-inline { padding: 0; margin-top: 14px; }
.spec-notes { padding: 14px 18px 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.label-preview { display: flex; flex-direction: column; align-items: center; }
.label-preview .barcode { max-width: 100%; height: auto; border-radius: 6px; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; transition: background .2s; }
.hist-row + .hist-row { border-top: 1px solid var(--line); }
.hist-row:hover { background: var(--surface-2); }
.hist-row .li-body { flex: 1; min-width: 0; }
.timeline-card { overflow: hidden; }

/* 報告 */
.report-row { padding: 16px 18px; }
.report-row + .report-row { border-top: 1px solid var(--line); }
.report-row.is-resolved { opacity: .75; }
.report-body { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.report-item { display: flex; align-items: center; gap: 12px; }
.report-item .li-title { font-weight: 700; }
.resolve { margin-top: 10px; }
.resolve > summary { list-style: none; cursor: pointer; display: inline-flex; }
.resolve > summary::-webkit-details-marker { display: none; }
.resolve[open] > summary { display: none; }
.resolve-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; animation: rise .3s var(--ease); }

/* 返却時の状態（問題なし・不具合・故障・紛失） */
.cond-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cond-picker label { position: relative; cursor: pointer; }
.cond-picker input { position: absolute; opacity: 0; }
.cond-picker label > span { display: flex; align-items: center; justify-content: center; height: 38px; border-radius: 10px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); border: 1px solid transparent; transition: all .2s; text-align: center; line-height: 1.2; }
.cond-picker input:checked + .cond-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.cond-picker input:checked + .cond-defect, .cond-picker input:checked + .cond-other { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.cond-picker input:checked + .cond-broken, .cond-picker input:checked + .cond-lost { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.cond-picker input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.cond-sm label > span { height: 32px; font-size: 12px; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 14px; border: 1px solid transparent; }
.radio-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* 物品の登録フォーム */
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.quick-chip { height: 28px; padding: 0 11px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all .2s; }
.quick-chip:hover { border-color: var(--accent); color: var(--accent); }
.select:disabled { opacity: .5; }
.image-slots { display: flex; gap: 12px; flex-wrap: wrap; }
.image-slot { position: relative; width: 132px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.image-slot img { width: 100%; height: 100%; object-fit: cover; }
.image-slot.is-removed img { opacity: .25; filter: grayscale(1); }
.image-slot.is-removed::after { content: "削除"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--danger); font-size: 13px; }
.image-remove { position: absolute; top: 6px; right: 6px; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.image-new { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--accent); color: #fff; }
.image-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed var(--line-2); background: transparent; color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 600; transition: border-color .2s, color .2s; }
.image-add:hover { border-color: var(--accent); color: var(--accent); }
.has-error .image-add { border-color: var(--danger); }
@media (max-width: 640px) { .image-slot { width: calc((100% - 24px) / 3); } }
.acc-chips { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.acc-chip { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 8px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; animation: pop .3s var(--spring); }
.acc-chip img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: none; }
.acc-chip > .truncate { flex: 1; }
.acc-chip button { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); }
.acc-chip button:hover { background: var(--surface-3); color: var(--text); }
.form-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-direction: row-reverse; align-items: center; gap: 10px; margin-top: 18px; padding: 14px 0 18px; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 960px) { .form-actions { bottom: calc(var(--tabbar-h) + var(--safe-b) + 4px); } }

/* ジャンル管理 */
.genre-add { display: flex; gap: 10px; align-items: center; }
.genre-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.genre-card { padding: 8px 10px 10px; scroll-margin-top: 90px; }
.genre-head, .sub-row { display: flex; align-items: center; gap: 8px; }
.genre-head { padding: 6px 4px; }
.genre-name { flex: 1; min-width: 0; }
.input-inline { min-height: 38px; padding: 6px 10px; background: transparent; border-color: transparent; font-weight: 700; }
.input-inline:hover { border-color: var(--line); }
.sub-row .input-inline { font-weight: 500; font-size: 14px; }
.genre-move { display: flex; }
.genre-move .icon-btn, .genre-head .icon-btn, .sub-row .icon-btn { width: 34px; height: 34px; }
.genre-move .icon-btn:disabled { opacity: .25; pointer-events: none; }
.sub-list { padding-left: 22px; }
.sub-branch { width: 14px; height: 20px; margin-top: -14px; border-left: 2px solid var(--line-2); border-bottom: 2px solid var(--line-2); border-bottom-left-radius: 8px; flex: none; }
.sub-add .input-inline { font-weight: 500; font-size: 14px; color: var(--text-2); }

/* 貸し出し・返却の受付 */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px 34px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); transition: transform .35s var(--ease), box-shadow .35s, border-color .35s; }
.mode-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-2); }
.mode-card b { font-size: 24px; margin-top: 10px; }
.mode-card span:last-child { color: var(--text-2); font-size: 13.5px; }
.mode-icon { width: 88px; height: 88px; border-radius: 28px; display: grid; place-items: center; color: #fff; transition: transform .4s var(--spring); }
.mode-card:hover .mode-icon { transform: scale(1.06) rotate(-4deg); }
@media (max-width: 640px) { .mode-card { padding: 26px 12px 22px; } .mode-icon { width: 64px; height: 64px; border-radius: 20px; } .mode-card b { font-size: 19px; } }

.desk-top { display: flex; justify-content: center; padding: 14px 0 16px; }
.desk-seg a { height: 40px; padding: 0 22px; font-size: 14.5px; }
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
@media (max-width: 1040px) { .desk { grid-template-columns: minmax(0, 1fr); } }
.desk-side { position: sticky; top: calc(var(--topbar-h) + 12px); }
@media (max-width: 1040px) { .desk-side { position: static; } }
.borrower-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.borrower-who { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; }
.bw-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.bw-text b { font-size: 16px; }
.bw-mail { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
.bw-mail.is-ok { color: var(--text-3); }
.bw-mail.is-missing { color: var(--warn); font-weight: 700; text-align: left; }
.bw-mail.is-missing:hover { text-decoration: underline; }

.scan-card { padding: 16px; }
.scan-input-row { display: flex; gap: 10px; }
.scan-input { flex: 1; }
.scan-input .input { height: 56px; font-size: 18px; letter-spacing: .04em; border-radius: 14px; }
.scan-cam-btn { height: 56px; border-radius: 14px; }
.scan-cam-btn.is-on { background: var(--surface-3); --btn-fg: var(--text); box-shadow: none; }
@media (max-width: 640px) { .scan-input-row { flex-direction: column-reverse; } .scan-cam-btn { width: 100%; } }
.camera { position: relative; margin-top: 14px; border-radius: 18px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; max-height: 60vh; width: 100%; }
.camera video { width: 100%; height: 100%; object-fit: cover; }
.camera-frame { position: absolute; inset: 18% 14%; border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.85); pointer-events: none; }
.camera-line { position: absolute; left: 16%; right: 16%; height: 2px; top: 50%; background: #2fe0c0; box-shadow: 0 0 14px 2px rgba(47,224,192,.8); animation: cam-line 2.4s ease-in-out infinite; pointer-events: none; }
@keyframes cam-line { 0%, 100% { top: 22%; } 50% { top: 78%; } }
.camera-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; }
.camera-bar .icon-btn { color: #fff; background: rgba(255,255,255,.14); }
.camera-bar .select { background-color: rgba(0,0,0,.5); color: #fff; border-color: rgba(255,255,255,.2); max-width: 46%; }
.camera-msg { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.camera-msg.error, .modal .camera + .error { color: #ff8a98; }
.modal .camera { margin-top: 0; }
.scan-feedback { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; }
.scan-feedback .i { margin-top: 1px; }
.scan-feedback.is-ok { background: var(--ok-soft); color: var(--ok); }
.scan-feedback.is-ok b, .scan-feedback.is-error b, .scan-feedback.is-info b { color: var(--text); }
.scan-feedback.is-error { background: var(--danger-soft); color: var(--danger); }
.scan-feedback.is-info { background: var(--info-soft); color: var(--info); }

.basket { overflow: hidden; }
.basket-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px 10px; }
.basket-head h2 { font-size: 16px; }
.basket-head .count { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.basket-list { max-height: calc(100dvh - 400px); min-height: 160px; overflow-y: auto; }
@media (max-width: 1040px) { .basket-list { max-height: none; } }
.basket-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 20px 36px; gap: 2px; }
.basket-row { padding: 12px 16px; border-top: 1px solid var(--line); }
.basket-row.is-new { animation: basket-in .5s var(--spring) both; }
@keyframes basket-in { from { opacity: 0; transform: translateY(-10px) scale(.98); background: var(--accent-soft); } }
.br-main { display: flex; align-items: center; gap: 12px; }
.br-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.br-name { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-name:hover { color: var(--accent); }
.br-sub { font-size: 12px; color: var(--text-3); }
.due-text.due-overdue { color: var(--danger); font-weight: 700; background: none; }
.due-text.due-today, .due-text.due-soon { color: var(--warn); font-weight: 700; background: none; animation: none; }
.acc-hint, .acc-text { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0 60px; font-size: 12.5px; color: var(--text-2); }
.acc-hint .i, .acc-text .i { margin-top: 2px; color: var(--accent); }
.acc-items { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0 60px; }
.acc-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 5px 6px 5px 9px; border-radius: 9px; background: var(--surface-2); }
.acc-item .truncate { flex: 1; }
.acc-item.is-in { color: var(--ok); background: var(--ok-soft); }
.acc-add { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 8px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; }
.acc-checks { display: flex; flex-direction: column; gap: 2px; margin: 10px 0 0 60px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.acc-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 2px 0; }
.acc-check input { width: 16px; height: 16px; accent-color: var(--ok); }
.basket-row .cond-picker { margin: 10px 0 0 60px; }
.cond-note { margin: 8px 0 0 60px; }
.cond-note .textarea { min-height: 64px; font-size: 14px; }
@media (max-width: 640px) {
  .acc-hint, .acc-text, .acc-items, .acc-checks, .basket-row .cond-picker, .cond-note { margin-left: 0; }
}
.basket-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); background: var(--bg-elev); display: flex; flex-direction: column; gap: 14px; }
.basket-foot .field + .field { margin-top: 0; }
.borrowed .list-item .btn { flex: none; }

.desk-done { max-width: 560px; margin: 30px auto 0; text-align: center; padding: 40px 24px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); }
.done-check { width: 92px; height: 92px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; box-shadow: 0 0 0 10px var(--ok-soft); animation: done-pop .6s var(--spring) both; }
.done-check .i { stroke-width: 3; }
@keyframes done-pop { from { transform: scale(.3); opacity: 0; } }
.desk-done h2 { font-size: 24px; margin-bottom: 8px; }
.desk-done p + p { margin-top: 6px; }
.desk-done p .i { display: inline; vertical-align: -3px; }
.done-list { list-style: none; padding: 0; margin: 20px 0 0; text-align: left; display: flex; flex-direction: column; gap: 2px; border-radius: 14px; background: var(--surface-2); padding: 8px 14px; font-size: 14px; }
.done-list li { display: flex; gap: 10px; align-items: center; padding: 5px 0; }
.done-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }

/* 貸し出し一覧・詳細 */
.tabs-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.loan-groups { display: flex; flex-direction: column; gap: 14px; }
.loan-group { overflow: hidden; }
.loan-group-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.loan-group .list { padding: 4px; }
.li-note { display: block; margin-top: 6px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.loan-summary { padding: 18px 20px; }
.ls-row { display: flex; align-items: center; gap: 14px; }
.due-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.card.list { padding: 4px; }

/* ---------- 保管場所 ---------- */
.loc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.loc-chip { position: relative; cursor: pointer; }
.loc-chip input { position: absolute; opacity: 0; pointer-events: none; }
.loc-chip > span { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 12px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: all .2s var(--ease); }
.loc-chip > span .i { width: 0; opacity: 0; transition: width .2s, opacity .2s; }
.loc-chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.loc-chip input:checked + span .i { width: 14px; opacity: 1; }
.loc-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.loc-chip small { font-size: 10.5px; padding: 0 5px; border-radius: 5px; background: var(--accent); color: #fff; }
.loc-add { display: flex; gap: 8px; margin-top: 12px; }
.loc-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; color: var(--text-3); }
.item-card-loc { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-3); }
.item-card-loc .i { width: 12px; height: 12px; flex: none; }
.inline-i { display: inline; vertical-align: -2px; width: 12px; height: 12px; }
.loc-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; scroll-margin-top: 90px; position: relative; }
.loc-row + .loc-row { border-top: 1px solid var(--line); }
.loc-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.loc-row-main .input-inline { min-height: 32px; padding: 3px 8px; }
.loc-note { font-weight: 400 !important; font-size: 12.5px !important; color: var(--text-2); }
@media (max-width: 640px) { .loc-row .genre-move { display: none; } }

/* ---------- 選んで一括発行 ---------- */
.item-select { display: none; position: absolute; z-index: 3; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; place-items: center; background: rgba(0,0,0,.45); border: 2px solid #fff; color: transparent; }
.loc-row .item-select { position: static; flex: none; border-color: var(--line-2); background: var(--surface-2); }
.is-selecting .item-select { display: grid; }
.is-selecting [data-select-id] { cursor: pointer; }
.is-selecting [data-select-id] .loc-row-main, .is-selecting .loc-row .genre-move, .is-selecting .loc-row .menu-wrap { pointer-events: none; }
.is-selected .item-select { background: var(--accent); border-color: var(--accent); color: #fff; }
.item-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.loc-row.is-selected { background: var(--accent-soft); }
.select-bar { position: fixed; z-index: 60; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(calc(100% - 24px), 640px); display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .3s var(--ease); flex-wrap: wrap; }
@media (min-width: 961px) { .select-bar { left: calc(50% + var(--sidebar-w) / 2); } }
@media (max-width: 960px) { .select-bar { bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); } }

/* ---------- バーコードの発行 ---------- */
.bc-layouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .bc-layouts { grid-template-columns: 1fr; } }
.bc-layout { position: relative; cursor: pointer; }
.bc-layout input { position: absolute; opacity: 0; }
.bc-layout > span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; transition: all .2s var(--ease); }
.bc-layout input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.bc-layout b { font-size: 14px; margin-top: 8px; }
.bc-layout small { font-size: 12px; color: var(--text-2); line-height: 1.5; }
@media (max-width: 640px) { .bc-layout > span { display: grid; grid-template-columns: 48px 1fr; column-gap: 12px; align-items: center; } .bc-layout .bc-sheet { grid-row: span 2; } .bc-layout b { margin-top: 0; } }
.bc-sheet { display: grid; grid-template-columns: repeat(var(--cols, 1), 1fr); gap: 2px; width: 44px; height: 62px; padding: 4px; border-radius: 4px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); align-content: start; }
.bc-sheet i { display: block; background: #c9d6dd; border-radius: 1px; height: 3px; }
.bc-sheet-31268 i { height: 4px; }
.bc-sheet-72200 { gap: 1px 2px; }
.bc-sheet-72200 i { height: 1.4px; }
.bc-sheet-list { grid-template-columns: 1fr; gap: 3px; }
.bc-sheet-list i { height: 7px; background: linear-gradient(90deg, #c9d6dd 60%, transparent 60%, transparent 66%, #556 66%); }
.bc-adjust { margin-top: 16px; }
.bc-adjust summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; }
.input-sm { display: inline-block; width: 80px; min-height: 34px; padding: 4px 8px; font-size: 14px; margin: 0 4px; }

/* ---------- 棚卸し ---------- */
.grid-stocktakes { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.st-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.st-card.is-open { border-color: var(--accent-ring); }
.st-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-card h3 { font-size: 17px; margin-top: 8px; }
.st-card-nums { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.st-card-nums b { display: block; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.st-card-nums .is-danger b { color: var(--danger); }
.st-card-nums .is-warn b { color: var(--warn); }
.st-progress { display: flex; align-items: center; gap: 20px; padding: 20px 22px; flex-wrap: wrap; }
.st-progress-body { flex: 1; min-width: 220px; }
.st-progress-title { font-weight: 800; font-size: 17px; }
.st-progress-sub { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; background: var(--surface-3); color: var(--text-2); }
.tab-count.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tab-count.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tab-count.tone-info { background: var(--info-soft); color: var(--info); }
.tab-count.tone-danger { background: var(--danger-soft); color: var(--danger); }
.st-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 0; border-radius: 14px; }
.st-row + .st-row { border-top: 1px solid var(--line); border-radius: 0; }
.st-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; }
.st-row-main:hover { background: var(--surface-2); }
.st-row-main .li-body { flex: 1; min-width: 0; }
.st-row-main .li-title { font-weight: 600; font-size: 14px; }
.st-row-main .li-sub { font-size: 12.5px; color: var(--text-3); }
.st-row-side { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .st-row { flex-wrap: wrap; } .st-row-side { width: 100%; padding: 0 0 8px 70px; justify-content: flex-start; } }
.st-scan-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 16px; }
.st-mini { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 120px; font-size: 13px; }
.st-mini .bar { width: 120px; }
.st-mini .bar > span { transition: width .6s var(--ease); }
.st-flag { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 0 60px; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; background: var(--warn-soft); color: var(--text); flex-wrap: wrap; }
.st-flag .i { margin-top: 2px; color: var(--warn); }
.st-flag > span:not(.flag-actions) { flex: 1; min-width: 160px; }
.st-flag.is-extra, .st-flag.is-on_loan { background: var(--info-soft); }
.st-flag.is-extra .i, .st-flag.is-on_loan .i { color: var(--info); }
.flag-actions { display: flex; gap: 6px; }
.acc-add.is-ghost { background: var(--surface); color: var(--accent); border: 1px solid var(--accent-ring); }
@media (max-width: 640px) { .st-flag { margin-left: 0; } }
.sound-btn { height: 56px; width: 56px; border-radius: 14px; flex: none; }
.sound-btn.is-off { color: var(--text-3); }
@media (max-width: 640px) { .scan-input-row { display: grid; grid-template-columns: 1fr auto; } .scan-cam-btn { grid-column: 1 / -1; order: -1; } }

/* ---------- 権限 ---------- */
.perm-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .perm-options { grid-template-columns: 1fr; } }
.perm-option { position: relative; cursor: pointer; }
.perm-option input { position: absolute; opacity: 0; }
.perm-option > span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; transition: all .2s; }
.perm-option b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.perm-option small { font-size: 12px; color: var(--text-2); line-height: 1.55; }
.perm-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.perm-periods .chip-tab { cursor: pointer; }
.perm-chosen { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent-ring); }
.perm-chosen > span:not(.avatar) { flex: 1; min-width: 0; }
.perm-user { padding: 14px 18px; scroll-margin-top: 90px; }
.perm-user + .perm-user { border-top: 1px solid var(--line); }
.perm-user-head { display: flex; align-items: center; gap: 12px; }
.perm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 0 48px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.perm-row.is-expired { opacity: .7; }
@media (max-width: 640px) { .perm-row { margin-left: 0; } }
.perm-banner .btn { flex: none; }
