:root{
  --bg:#0b0c10;
  --side:#11131b;
  --panel:#181b25;
  --card:#202433;
  --card2:#2a3042;
  --input:#11141d;
  --text:#f7f7fb;
  --muted:#b7bac8;
  --soft:#858a9c;
  --accent:#e91e63;
  --accent2:#c2185b;
  --border:#343a4c;
  --success:#3ddc97;
  --danger:#ff5c7a;
}

*{box-sizing:border-box}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Yu Gothic UI","Hiragino Sans",sans-serif;
  line-height:1.55;
}

.app{
  min-height:100vh;
  display:grid;
  grid-template-columns:270px 1fr;
}

.sidebar{
  background:linear-gradient(180deg,#12141d 0%,#0f1118 100%);
  padding:22px 18px;
  position:sticky;
  top:0;
  height:100vh;
  border-right:1px solid var(--border);
}

.brand{
  display:flex;
  gap:13px;
  align-items:center;
  margin-bottom:28px;
  padding:8px 4px 16px;
  border-bottom:1px solid var(--border);
}

.logo-box{
  width:58px;
  height:58px;
  min-width:58px;
  border-radius:18px;
  overflow:hidden;
  background:var(--card);
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
}

.logo-box img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.logo-box.fallback-logo::after{
  content:"🐒";
  font-size:30px;
}

.brand h1{
  font-size:20px;
  line-height:1.1;
  margin:0;
  letter-spacing:.2px;
}

.brand p{
  color:var(--muted);
  margin:5px 0 0;
  font-size:12px;
  font-weight:700;
}

nav{
  display:flex;
  flex-direction:column;
  gap:8px;
}

nav a{
  color:var(--text);
  text-decoration:none;
  padding:14px 15px;
  border-radius:15px;
  font-weight:800;
  font-size:15px;
  background:transparent;
  border:1px solid transparent;
  transition:.15s ease;
}

nav a:hover{
  background:var(--card);
  border-color:var(--border);
}

nav a.active{
  background:linear-gradient(135deg,var(--accent),#f04b8a);
  color:#fff;
  box-shadow:0 10px 24px rgba(233,30,99,.25);
}

.version{
  color:var(--soft);
  position:absolute;
  bottom:20px;
  left:22px;
  font-size:12px;
  font-family:Consolas,monospace;
}

.main{
  padding:30px;
  max-width:1320px;
  width:100%;
}

.header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
  margin-bottom:22px;
}

.header h2{
  margin:0;
  font-size:36px;
  line-height:1.15;
  letter-spacing:.2px;
}

.header p{
  color:var(--muted);
  margin:8px 0 0;
  font-size:15px;
}

.cards{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
  margin-bottom:20px;
}

.card{
  background:linear-gradient(180deg,#232838 0%,#1e2230 100%);
  border:1px solid var(--border);
  border-radius:24px;
  padding:20px;
  min-height:128px;
  box-shadow:0 8px 24px rgba(0,0,0,.18);
}

.card span{
  display:block;
  color:var(--muted);
  font-weight:800;
  font-size:13px;
  letter-spacing:.2px;
}

.card strong{
  display:block;
  font-size:36px;
  margin:8px 0 3px;
  line-height:1;
}

.card small{
  color:var(--soft);
  font-size:12px;
  font-weight:700;
}

.panel{
  background:linear-gradient(180deg,#1b1f2b 0%,#181b25 100%);
  border:1px solid var(--border);
  border-radius:24px;
  padding:22px;
  margin-bottom:20px;
  box-shadow:0 8px 24px rgba(0,0,0,.14);
}

.panel h3{
  margin:0 0 16px;
  font-size:20px;
}

.quick-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
}

.quick-grid a{
  background:var(--card2);
  color:var(--text);
  text-decoration:none;
  border-radius:17px;
  padding:18px 14px;
  font-weight:900;
  text-align:center;
  border:1px solid var(--border);
}

.quick-grid a:hover{
  background:var(--accent);
  border-color:var(--accent);
}

.primary-btn, button{
  border:none;
  border-radius:15px;
  padding:14px 18px;
  background:var(--card2);
  color:white;
  font-weight:900;
  cursor:pointer;
  font-size:14px;
  border:1px solid var(--border);
  min-height:46px;
}

.primary-btn{
  background:linear-gradient(135deg,var(--accent),#f04b8a);
  text-decoration:none;
  border-color:transparent;
}

button:hover,.primary-btn:hover{
  filter:brightness(1.08);
}

button:disabled{
  opacity:.5;
  cursor:not-allowed;
}

.form-grid{
  display:grid;
  grid-template-columns:210px 1fr;
  gap:16px;
  align-items:center;
}

.form-grid.small{
  grid-template-columns:180px 1fr;
  margin-top:16px;
}

label{
  font-weight:800;
  color:var(--muted);
}

input, textarea, select{
  width:100%;
  background:var(--input);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:15px;
  padding:14px 15px;
  font-size:16px;
  outline:none;
}

input:focus, textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(233,30,99,.15);
}

textarea{
  resize:vertical;
  min-height:160px;
}

.block-label{
  display:block;
  margin-bottom:10px;
  font-size:15px;
}

.checks{
  display:flex;
  gap:20px;
  flex-wrap:wrap;
  margin:16px 0;
  padding:12px;
  background:#141720;
  border:1px solid var(--border);
  border-radius:16px;
}

.checks label,.check{
  color:var(--text);
}

.button-row{
  display:flex;
  gap:12px;
  margin-top:16px;
  flex-wrap:wrap;
}

.logbox{
  background:#11141d;
  border:1px solid var(--border);
  border-radius:18px;
  padding:16px;
  min-height:300px;
  overflow:auto;
  color:#e4e5ec;
  white-space:pre-wrap;
  font-size:14px;
}

.table-wrap{
  overflow:auto;
  border:1px solid var(--border);
  border-radius:18px;
}

table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
  min-width:760px;
}

th,td{
  border-bottom:1px solid var(--border);
  padding:12px;
  text-align:left;
}

th{
  color:var(--muted);
  background:#151822;
  font-weight:900;
}

td{
  color:#eaebf1;
}

.flash-wrap{
  margin-bottom:16px;
}

.flash{
  padding:13px 16px;
  border-radius:15px;
  margin-bottom:8px;
  background:var(--card);
  font-weight:800;
}

.flash.success{
  border:1px solid var(--success);
  color:#d8ffee;
}

.flash.error{
  border:1px solid var(--danger);
  color:#ffdce4;
}

.two-col{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}

.tag-list{
  display:flex;
  flex-wrap:wrap;
  gap:9px;
}

.tag-list span{
  padding:9px 12px;
  border-radius:999px;
  background:var(--card2);
  border:1px solid var(--border);
  font-weight:800;
}

code{
  background:#11131a;
  padding:2px 7px;
  border-radius:7px;
  color:#fff;
}

@media (max-width: 920px){
  .app{
    grid-template-columns:1fr;
  }

  .sidebar{
    position:static;
    height:auto;
    padding:16px;
  }

  .brand{
    margin-bottom:14px;
  }

  nav{
    flex-direction:row;
    overflow:auto;
    padding-bottom:6px;
  }

  nav a{
    white-space:nowrap;
    min-width:max-content;
    font-size:14px;
  }

  .version{
    display:none;
  }

  .main{
    padding:18px;
  }

  .header{
    align-items:flex-start;
    flex-direction:column;
  }

  .cards{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .quick-grid{
    grid-template-columns:1fr 1fr;
  }

  .form-grid,.form-grid.small{
    grid-template-columns:1fr;
  }

  .two-col{
    grid-template-columns:1fr;
  }
}

@media (max-width: 560px){
  .main{
    padding:14px;
  }

  .header h2{
    font-size:29px;
  }

  .header p{
    font-size:14px;
  }

  .cards{
    grid-template-columns:1fr;
  }

  .card{
    min-height:110px;
  }

  .quick-grid{
    grid-template-columns:1fr;
  }

  .panel{
    padding:16px;
    border-radius:20px;
  }

  .brand h1{
    font-size:18px;
  }

  textarea{
    min-height:180px;
  }

  .button-row{
    flex-direction:column;
  }

  .button-row button,
  .button-row .primary-btn{
    width:100%;
  }
}


.install-banner{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  width:min(560px,calc(100% - 28px));
  background:linear-gradient(135deg,#202433,#171922);
  border:1px solid var(--border);
  border-radius:20px;
  padding:12px;
  display:flex;
  align-items:center;
  gap:12px;
  box-shadow:0 18px 45px rgba(0,0,0,.35);
  z-index:999;
}

.install-banner div{
  flex:1;
}

.install-banner strong{
  display:block;
  font-size:14px;
}

.install-banner span{
  display:block;
  color:var(--muted);
  font-size:12px;
}

.install-banner button{
  min-height:38px;
  padding:9px 12px;
}

.ghost-btn{
  background:transparent;
}

.pwa-guide{
  border-color:rgba(233,30,99,.55);
  background:linear-gradient(135deg,rgba(233,30,99,.12),rgba(32,36,51,1));
}

@media (display-mode: standalone){
  .pwa-guide{
    display:none;
  }
}

@media (max-width:560px){
  .install-banner{
    align-items:stretch;
    flex-direction:column;
  }
  .install-banner button{
    width:100%;
  }
}

/* Login / Security */
.login-body{
  min-height:100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(233,30,99,.22), transparent 34%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,.08), transparent 28%),
    linear-gradient(180deg,#f7f7fb 0%,#eceef5 100%);
  color:#1d2327;
}

.login-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:28px 16px;
}

.login-card{
  width:100%;
  max-width:430px;
  background:#fff;
  border:1px solid #dcdcde;
  border-radius:22px;
  padding:34px 30px 28px;
  box-shadow:0 22px 70px rgba(17,24,39,.16);
}

.login-logo{
  width:88px;
  height:88px;
  margin:0 auto 18px;
  border-radius:24px;
  overflow:hidden;
  border:1px solid #e5e7eb;
  background:#f6f7f7;
  display:flex;
  align-items:center;
  justify-content:center;
}

.login-logo img{width:100%;height:100%;object-fit:cover}
.login-logo.fallback-logo::after{content:"🐒";font-size:44px}

.login-card h1{
  margin:0;
  text-align:center;
  font-size:28px;
  color:#1d2327;
  letter-spacing:.2px;
}

.login-lead{
  margin:10px 0 24px;
  text-align:center;
  color:#646970;
  font-size:14px;
}

.login-form label{
  display:block;
  margin:14px 0 7px;
  color:#1d2327;
  font-weight:700;
  font-size:14px;
}

.login-form input{
  width:100%;
  min-height:48px;
  border:1px solid #8c8f94;
  border-radius:8px;
  padding:10px 13px;
  background:#fff;
  color:#1d2327;
  font-size:16px;
  outline:none;
}

.login-form input:focus{
  border-color:#e91e63;
  box-shadow:0 0 0 3px rgba(233,30,99,.16);
}

.login-submit{
  width:100%;
  margin-top:22px;
  min-height:50px;
  border:0;
  border-radius:10px;
  background:linear-gradient(135deg,#e91e63,#c2185b);
  color:#fff;
  font-size:16px;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 12px 24px rgba(233,30,99,.22);
}

.login-submit:hover{filter:brightness(1.04)}
.login-flash{margin-bottom:16px}

.login-note{
  margin-top:18px;
  padding:12px 13px;
  border-radius:10px;
  background:#f6f7f7;
  color:#50575e;
  font-size:12px;
  line-height:1.55;
}

.login-note code{
  color:#c2185b;
  font-weight:800;
}

.login-version{
  margin-top:14px;
  text-align:center;
  color:#8c8f94;
  font-size:12px;
  font-family:Consolas,monospace;
}

.logout-form{
  position:absolute;
  bottom:44px;
  left:18px;
  right:18px;
}

.logout-form button{
  width:100%;
  border:1px solid var(--border);
  background:transparent;
  color:var(--muted);
  border-radius:12px;
  padding:10px 12px;
  font-weight:800;
  cursor:pointer;
}

.logout-form button:hover{
  background:var(--card);
  color:var(--text);
}

.change-password-card textarea,
.hash-box textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(30, 41, 59, 0.16);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
  background: #fff7fb;
}
.hash-box {
  margin: 16px 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(233,30,99,.18);
}


/* v7.5 Product UI */
.setup-score{
  background:linear-gradient(135deg,var(--accent),#f04b8a);
  color:#fff;
  border-radius:999px;
  padding:12px 18px;
  font-weight:900;
  box-shadow:0 10px 24px rgba(233,30,99,.22);
}
.checklist,.mini-checklist{
  display:grid;
  gap:12px;
}
.check-item{
  border:1px solid var(--border);
  background:var(--card2);
  border-radius:16px;
  padding:14px 16px;
}
.check-item strong{display:block;margin-bottom:4px;}
.check-item span{color:var(--muted);font-size:13px;}
.check-item.ok{border-color:rgba(61,220,151,.45);}
.check-item.ng{border-color:rgba(255,92,122,.45);}
.setup-form h3{
  margin:26px 0 14px;
  padding-top:18px;
  border-top:1px solid var(--border);
}
.setup-form h3:first-child{margin-top:0;padding-top:0;border-top:none;}
.setup-actions{margin-top:22px;}
.ghost-link{
  color:var(--muted);
  text-decoration:none;
  font-weight:800;
  padding:14px 12px;
}
.setup-alert{
  border-color:rgba(255,92,122,.45);
  background:linear-gradient(180deg,rgba(255,92,122,.10),rgba(27,31,43,.95));
}
.mini-checklist{
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  margin:16px 0;
}
.mini-checklist span{
  border:1px solid var(--border);
  background:var(--card2);
  border-radius:999px;
  padding:9px 12px;
  font-size:13px;
  font-weight:800;
}
.mini-checklist span.ok{border-color:rgba(61,220,151,.45);}
.mini-checklist span.ng{border-color:rgba(255,92,122,.45);}
@media(max-width:760px){
  .setup-score{align-self:flex-start;}
  .mini-checklist{grid-template-columns:1fr;}
}
