/* ==========================================================================
   Sakura Panel — GUI v2 (P6, Takahashi 2026-10-24)
   CWP-grade professional layout with the Sakura identity:
   deep navy sidebar, grouped navigation, cyan accents, sakura-pink brand.
   ========================================================================== */
:root {
  --navy: #181F32;
  --navy-2: #10162a;
  --navy-3: #232c47;
  --cyan: #50BDEB;
  --cyan-dark: #2f9fd8;
  --pink: #f6a9bd;
  --bg: #eef1f7;
  --card: #ffffff;
  --line: #e3e8f2;
  --ink: #23283b;
  --muted: #71809e;
  --ok: #1f9d66;
  --warn: #d9930d;
  --bad: #dd4257;
  --primary: var(--cyan-dark);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.55;
}
a { color: var(--cyan-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); background: #fdeef0; border: 1px solid #f6ccd2; border-radius: 9px; padding: 8px 11px; font-size: 13px; }
.success { color: var(--ok); }
code, .code-block { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }
.code-block { background: #0d1120; color: #a5e3ff; border-radius: 10px; padding: 12px 14px; overflow-x: auto; white-space: pre; }

/* ---------------- layout ---------------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 22px 26px 40px; max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---------------- sidebar ---------------- */
.sidebar {
  width: 238px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #dbe3f2; display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 17px 18px 13px;
  font-size: 16.5px; font-weight: 700; color: #fff; letter-spacing: .2px;
}
.logo-kanji {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; font-size: 19px; color: #fff;
  background: linear-gradient(135deg, #e77e9b, #c94f73); box-shadow: 0 3px 10px rgba(230, 120, 155, .45);
}
.nav { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-section {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #7186ad;
  padding: 15px 10px 5px; text-transform: uppercase;
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7.5px 10px;
  border-radius: 9px; color: #c3cee6; font-size: 13.5px; position: relative;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(80,189,235,.22), rgba(80,189,235,.07)); color: #fff; }
.nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px;
  border-radius: 3px; background: var(--cyan);
}
.nav a .nav-ico { width: 19px; height: 19px; flex-shrink: 0; display: inline-flex; }
.nav a .nav-ico svg { width: 19px; height: 19px; stroke: #93a5cc; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a.active .nav-ico svg, .nav a:hover .nav-ico svg { stroke: var(--cyan); }
.sidebar-footer { margin-top: auto; padding: 13px 16px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { font-size: 12.5px; color: #aebadd; margin-bottom: 9px; }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 13px 26px;
  display: flex; align-items: center; gap: 14px;
}
.topbar h1 { font-size: 17.5px; margin: 0; font-weight: 700; }
.topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.srv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 0 3px rgba(31,157,102,.18); }
.breadcrumb { color: var(--muted); font-size: 12.5px; }

/* ---------------- cards & grids ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 1px 2px rgba(16,24,64,.04);
}
.card h3 { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .05em; color: #3c4767; text-transform: uppercase; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.settings-section { margin-bottom: 18px; }

/* dashboard stat cards */
.stat-card { display: flex; align-items: center; gap: 13px; }
.stat-ico {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(80,189,235,.18), rgba(80,189,235,.07));
}
.stat-ico svg { width: 22px; height: 22px; stroke: var(--cyan-dark); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stat-ico.pink { background: linear-gradient(135deg, rgba(246,169,189,.35), rgba(246,169,189,.12)); }
.stat-ico.pink svg { stroke: #d1607f; }
.stat-value { font-size: 23px; font-weight: 700; line-height: 1.15; }
.stat-label { color: var(--muted); font-size: 12px; }
.bar { background: #e8edf6; border-radius: 99px; height: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan-dark), var(--cyan)); }
.bar > i.hot { background: linear-gradient(90deg, #e08a3c, var(--bad)); }
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.qa-grid .btn { justify-content: center; }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: #8492b3; background: #f7f9fd; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #eef1f7; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfe; }

/* ---------------- badges ---------------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #eef1f7; color: #54638a; }
.badge-active, .badge-completed { background: #e2f5ec; color: var(--ok); }
.badge-pending, .badge-running { background: #fdf3dd; color: var(--warn); }
.badge-failed, .badge-suspended { background: #fdeef0; color: var(--bad); }

/* ---------------- buttons & forms ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent;
  background: #eef1f7; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 9px; cursor: pointer; transition: filter .12s, background .12s;
}
.btn:hover { filter: brightness(.97); text-decoration: none; }
.btn-primary { background: linear-gradient(180deg, #3aa9de, var(--cyan-dark)); color: #fff; box-shadow: 0 2px 8px rgba(47,159,216,.35); }
.btn-danger { background: #fdeef0; color: var(--bad); border-color: #f3c3cb; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.25); color: #dbe3f2; }
.main .btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; justify-content: center; }
input, select, textarea {
  font: inherit; font-size: 13.5px; color: var(--ink); background: #fff;
  border: 1px solid #d4dbea; border-radius: 9px; padding: 8.5px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(80,189,235,.5); border-color: var(--cyan-dark); }
label { display: block; font-size: 12.5px; font-weight: 600; color: #43527a; margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 5px; }
.form-row { margin-bottom: 12px; }
.form-row label { margin-bottom: 5px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.toolbar .btn { margin-left: auto; }
.empty { background: var(--card); border: 1.5px dashed #ccd6ea; border-radius: var(--radius); padding: 34px 20px; text-align: center; color: var(--muted); }
.copy-btn { margin-left: 8px; }

/* metrics */
.metric-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid #eef1f7; }
.metric-row:last-child { border-bottom: 0; }
.metric-label { width: 130px; color: var(--muted); font-size: 12.5px; flex-shrink: 0; }
.metric-value { font-weight: 700; }
.metric-bar { flex: 1; }
.metric-bar-fill { height: 100%; background: linear-gradient(90deg, var(--cyan-dark), var(--cyan)); border-radius: 99px; }

/* switches & tabs */
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #eef1f7; }
.switch-label { font-weight: 700; }
.switch-desc { color: var(--muted); font-size: 12.5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 13px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--cyan-dark); border-color: var(--cyan-dark); }

/* apps page */
.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.app-card { text-align: left; }
.app-icon { font-size: 26px; margin-bottom: 8px; }
.app-name { font-weight: 700; margin-bottom: 4px; }
.app-desc { color: var(--muted); font-size: 12.5px; }

/* files */
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #eef1f7; }
.file-actions { margin-left: auto; display: flex; gap: 6px; }

/* notifications */
.notif-list { display: flex; flex-direction: column; }
.notif { display: flex; gap: 12px; padding: 12px 2px; border-bottom: 1px solid #eef1f7; }
.notif-unread { background: #f4faff; }
.notif-icon { font-size: 18px; }
.notif-title { font-weight: 700; }
.notif-text { color: var(--muted); font-size: 12.5px; }
.notif-time { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---------------- modal & toast ---------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(13,18,38,.55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: min(520px, 92vw); max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.modal h3 { margin: 0 0 14px; font-size: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; background: var(--navy); color: #fff;
  padding: 12px 17px; border-radius: 11px; box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: 13.5px;
  border-left: 4px solid var(--cyan);
}
.toast.error { border-left-color: var(--bad); }
.toast.success { border-left-color: var(--ok); }

/* ---------------- login ---------------- */
.login-view { min-height: 100vh; display: flex; }
.login-brand {
  flex: 1.1; background: linear-gradient(155deg, var(--navy) 0%, var(--navy-3) 65%, #3a2140 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 48px 56px;
}
.login-brand .big { font-size: 30px; font-weight: 700; display: flex; align-items: center; gap: 13px; }
.login-brand .big .logo-kanji { width: 46px; height: 46px; font-size: 25px; border-radius: 13px; }
.login-brand p { color: #b9c5de; max-width: 420px; margin: 16px 0 22px; }
.login-brand ul { list-style: none; padding: 0; margin: 0; color: #cfd9ee; font-size: 13.5px; }
.login-brand li { padding: 5px 0 5px 24px; position: relative; }
.login-brand li::before { content: "✓"; position: absolute; left: 2px; color: var(--cyan); font-weight: 700; }
.login-side { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 30px; background: var(--bg); }
.login-card { width: min(380px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 14px 40px rgba(16,24,64,.09); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-logo { display: none; }
.login-scene, .login-moon, .login-mountains, .login-torii, .petals, .petal { display: none !important; }

/* ---------------- responsive ---------------- */
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .app-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .sidebar { width: 66px; }
  .sidebar .nav a span.lbl, .sidebar-brand span.brand-name, .nav-section, .sidebar-user { display: none; }
  .sidebar-brand { justify-content: center; padding: 14px 6px; }
  .nav a { justify-content: center; }
  .grid-2, .app-grid { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; margin-bottom: 14px; }
  .content { padding: 16px 14px 32px; }
}

/* ---------------- F9: responsive repair + brand (2026-10-24) ----------------
   Fixes: missing .grid-3 (pages stacked vertically), grid items refusing to
   shrink (cards forced wider than the screen by their tables), unwrapped
   tables clipping on mobile, 100vh jumps with mobile browser chrome, and
   the cherry-blossom brand mark replaced by a plain "S" on navy/cyan.   */
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid > * { min-width: 0; }
.card { min-width: 0; }
.table-wrap { max-width: 100%; }
.app { min-height: 100dvh; }
.sidebar { height: 100dvh; }
.login-view { min-height: 100dvh; }
.logo-kanji {
  background: linear-gradient(135deg, #2f9fd8, #181F32);
  box-shadow: 0 3px 10px rgba(47, 159, 216, .4);
  font-weight: 700;
}
@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .btn { margin-left: 0; }
  .modal { width: 94vw; padding: 18px; }
  .topbar { padding: 11px 14px; }
  .topbar h1 { font-size: 16px; }
  .topbar { gap: 8px; }
  .topbar-user { max-width: 32vw; }
  .topbar .lang-select { max-width: 104px; }
  .stat-value { font-size: 20px; }
}

.sidebar-by { font-size: 11px; color: #7186ad; margin-bottom: 8px; letter-spacing: .04em; }
.sidebar-by strong { color: #aebadd; }
@media (max-width: 860px) { .sidebar-by { display: none; } }

/* ---------------- F10: mobile drawer navigation (2026-10-24) ---------------- */
.nav-toggle { display: none; }
.nav-scrim { display: none; }
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 1px solid var(--line); background: #fff;
    border-radius: 9px; font-size: 17px; cursor: pointer; color: var(--ink); flex-shrink: 0;
  }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 70; width: 268px; max-width: 84vw;
    transform: translateX(-106%); transition: transform .22s ease; box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: 18px 0 44px rgba(10, 15, 35, .35); }
  .sidebar .nav a span.lbl { display: inline; }
  .sidebar-brand span.brand-name { display: inline; }
  .sidebar .nav-section { display: block; }
  .sidebar .sidebar-user { display: block; }
  .sidebar .sidebar-by { display: block; }
  .sidebar .nav a { justify-content: flex-start; padding: 10px; }
  .sidebar-brand { justify-content: flex-start; padding: 17px 18px 13px; }
  .nav-scrim {
    display: block; position: fixed; inset: 0; background: rgba(13, 18, 38, .5);
    z-index: 65; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .nav-scrim.show { opacity: 1; pointer-events: auto; }
}

.lang-select { width: auto; padding: 6px 8px; font-size: 12.5px; border-radius: 8px; flex-shrink: 0; }
.topbar .lang-select { margin-left: auto; }
.topbar .lang-select + .topbar-user { margin-left: 0; }

/* LOGO v1 */
.logo-mark-img{width:36px;height:36px;border-radius:9px;object-fit:cover;vertical-align:middle;flex:none}

/* UX-A (Inoue 2026-10-27): dashboard feature grid + topbar feature search */
.feat-groups { display: grid; gap: 14px; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.feat-item { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line, #e3e8f2); border-radius: 10px; background: var(--card, #fff); cursor: pointer; font: inherit; text-align: left; min-width: 0; }
.feat-item:hover { border-color: var(--cyan, #22b8dd); }
.feat-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feat-ico svg { width: 20px; height: 20px; flex: none; }
.tb-search { position: relative; margin-left: 14px; flex: 0 1 200px; min-width: 0; }
.tb-search input { width: 100%; min-width: 0; padding: 7px 10px; border: 1px solid var(--line, #e3e8f2); border-radius: 8px; font: inherit; background: var(--card, #fff); }
.tb-search-results { position: absolute; top: calc(100% + 6px); left: 0; min-width: 230px; max-height: 320px; overflow: auto; background: var(--card, #fff); border: 1px solid var(--line, #e3e8f2); border-radius: 10px; box-shadow: 0 10px 30px rgba(10, 30, 60, .14); z-index: 60; padding: 5px; }
.tb-search-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; cursor: pointer; font: inherit; text-align: left; border-radius: 7px; }
.tb-search-item:hover { background: rgba(34, 184, 221, .10); }
.tb-search-empty { padding: 9px 10px; color: var(--muted); font-size: 13px; }
@media (max-width: 480px) {
  .feat-grid { grid-template-columns: 1fr 1fr; }
  .tb-search { flex-basis: 108px; margin-left: 8px; }
}
