/* =========================================================
   Tenon App — Unified Style.css (Clean + Stable)
   - Keeps your current HTML/JS unchanged
   - Matches the new Light Mint Glass sidebar
   - Fixes header sizing and layout weirdness
   - Removes duplicated/conflicting rules
   ========================================================= */

/* =========================
   GLOBAL
   ========================= */
h3 {
  display: block;
  font-size: 1.17em;
  margin-block-start: 1em;
  margin-block-end: 1em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  font-weight: 300;
  unicode-bidi: isolate;
}

/* Generic helper (used elsewhere too) */
.hidden {
  display: none !important;
}

/* =========================
   TOKENS / VARIABLES
   ========================= */
:root {
  /* Brand */
  --mint: #6fa891;
  --mint-deep: #4f715e;
  --ink-deep: #001508;

  /* Text */
  --text: #173326;
  --muted: #3b5f50;

  /* Glass + lines */
  --line: rgba(23, 51, 38, .12);
  --line-strong: rgba(111, 168, 145, .28);

  --glass: rgba(240, 249, 255, 0.82);
  --glass-2: rgba(255, 255, 255, 0.70);

  --shadow-soft: 0 6px 18px rgba(0,0,0,.06);
  --shadow-inset: inset 0 0 0 1px rgba(255,255,255,.55);

  /* Layout sizes */
  --header-h: 54px;
  --footer-h: 34px;

  /* Sidebar widths */
  --sb-w: 270px;
  --sb-w-lg: 280px;
  --sb-w-md: 250px;
  --sb-w-mobile: min(86vw, 330px);

  /* Sidebar placement aligned with header/footer */
  --sb-top: var(--header-h);
  --sb-bottom: var(--footer-h);

  /* Rounding */
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* =========================
   BASE / BACKGROUND
   ========================= */
html, body { height: 100%; }

body {
  margin: 0; /* Removed old margin-left to avoid layout drift */
  padding: 0;
  font-family: 'Poppins', sans-serif;

  background: linear-gradient(to bottom, #6fa89130, #6fa891b0);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;

  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* 🌫️ Wave Layers — oversize canvas so motion never shows edges */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -25vmax;
  width: calc(100% + 50vmax);
  height: calc(100% + 50vmax);

  background: radial-gradient(ellipse at 50% 50%, rgba(0, 180, 216, 0.08) 0%, transparent 70%);
  animation: waveAnim 40s linear infinite;
  z-index: -3;
  opacity: 0.3;
  will-change: transform;
}
body::after {
  animation-delay: 5s;
  background: radial-gradient(circle at 20% 30%, rgba(0, 200, 150, 0.05) 0%, transparent 70%);
  opacity: 0.25;
}

@keyframes waveAnim {
  0%   { transform: rotate(0deg) translateX(0) scale(1.05); }
  50%  { transform: rotate(180deg) translateX(-10%) scale(1.05); }
  100% { transform: rotate(360deg) translateX(0) scale(1.05); }
}

/* Pattern Drift — fixed, overscanned layer */
.security-bg-pattern {
  position: fixed;
  inset: -20vmax;
  width: calc(100% + 40vmax);
  height: calc(100% + 40vmax);
  z-index: -2;
  pointer-events: none;

  background-image:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.02) 0px, rgba(0, 0, 0, 0.02) 1px, transparent 1px, transparent 20px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.02) 0px, rgba(0, 0, 0, 0.02) 1px, transparent 1px, transparent 20px);

  animation: driftPattern 60s linear infinite;
}

@keyframes driftPattern {
  0%   { transform: translate3d(0%, 0%, 0); }
  100% { transform: translate3d(10%, 5%, 0); }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .security-bg-pattern {
    animation: none !important;
  }
}

/* =========================================================
   SIDEBAR — Tenon Light Glass
   ========================================================= */
.sidebar {
  position: fixed;
  top: var(--sb-top);
  bottom: var(--sb-bottom);
  left: 0;

  width: var(--sb-w);
  padding: 14px 12px 18px;

  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;

  z-index: 1000;

  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 12.8px;
  line-height: 1.35;
  color: var(--text);

  background:
    linear-gradient(135deg, rgba(111,168,145,.08), rgba(37,99,235,.06)),
    rgba(255,255,255,.78);

  backdrop-filter: blur(10px) saturate(115%);
  border-right: 1px solid rgba(111,168,145,.25);

  box-shadow:
    6px 0 22px rgba(0,0,0,.06),
    inset 0 1px 0 rgba(255,255,255,.65);

  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);

  transition: transform .25s ease, width .2s ease, box-shadow .2s ease;
  will-change: transform;
}

.sidebar.hidden { transform: translateX(-100%); }

/* Section cards */
.sidebar details {
  margin-bottom: 10px;
  border-radius: 12px;

  border: 1px solid var(--line);
  border-left: 4px solid rgba(111,168,145,.28);

  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.75));
  box-shadow: 0 2px 10px rgba(0,0,0,.04);

  transition: box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.sidebar details:hover { box-shadow: 0 8px 18px rgba(0,0,0,.07); }
.sidebar details[open] {
  border-color: rgba(111,168,145,.28);
  border-left-color: rgba(111,168,145,.5);

  background: linear-gradient(180deg, #f7fffb, #eef7f2);
  box-shadow: 0 10px 22px rgba(0,0,0,.09);
}

/* Section headers */
.sidebar summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 10px 12px;
  border-radius: 10px;

  cursor: pointer;
  list-style: none;
  outline: none;

  color: var(--text);

  background:
    linear-gradient(135deg, rgba(111,168,145,.14), rgba(37,99,235,.08)),
    linear-gradient(180deg, #ffffff, #f6fbf8);

  border: 1px solid rgba(111,168,145,.12);
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.sidebar summary::-webkit-details-marker { display: none; }

.sidebar summary:hover {
  border-color: rgba(111,168,145,.28);
  background:
    linear-gradient(135deg, rgba(111,168,145,.18), rgba(37,99,235,.10)),
    linear-gradient(180deg, #ffffff, #f2fbf6);
}

/* Chevron */
.sidebar summary::after {
  content: "▸";
  margin-left: auto;
  font-size: 11px;
  color: var(--mint);
  transition: transform .2s ease, opacity .2s ease;
  opacity: .9;
}
.sidebar details[open] summary::after { transform: rotate(90deg); }

/* Left rail glow */
.sidebar summary::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--mint), transparent);
  opacity: 0;
  transition: opacity .2s ease;
}
.sidebar summary:hover::before,
.sidebar details[open] summary::before { opacity: 1; }

/* Links */
.sidebar a {
  display: block;
  margin: 4px 8px;
  padding: 8px 12px 8px 20px;

  font-size: 12.6px;
  color: var(--muted);
  text-decoration: none;

  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  position: relative;

  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .08s ease;
}
.sidebar a:hover {
  background: rgba(111,168,145,.10);
  color: var(--text);
  border-color: rgba(111,168,145,.22);
  transform: translateX(1px);
}
.sidebar a.active,
.sidebar a[aria-current="page"] {
  background: rgba(111,168,145,.16);
  color: var(--text);
  border-color: rgba(111,168,145,.32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}

/* Tiny dot deco */
.sidebar a::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translate(-12px, -50%);
  background: radial-gradient(circle at 30% 30%, #ffffff, var(--mint));
  opacity: .85;
}

/* Focus */
.sidebar a:focus-visible,
.sidebar summary:focus-visible {
  outline: 2px solid rgba(111,168,145,.65);
  outline-offset: 3px;
}

/* =========================================================
   CRITICAL NAV — DB Backup
   ========================================================= */
.sidebar details.db-backup-nav{
  border-left-color: rgba(220,38,38,.55);
  border-color: rgba(220,38,38,.25);
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(254,242,242,.75));
}
.sidebar details.db-backup-nav[open]{
  border-left-color: rgba(220,38,38,.75);
  border-color: rgba(220,38,38,.32);
  background: linear-gradient(180deg, #fff7f7, #fff1f2);
}
.sidebar details.db-backup-nav summary{
  color: rgba(185,28,28,.95);
}
.sidebar a.nav-critical{
  background: rgba(220,38,38,.08);
  border-color: rgba(220,38,38,.28);
  color: rgba(185,28,28,.95);
}
.sidebar a.nav-critical:hover{
  background: rgba(220,38,38,.12);
  border-color: rgba(220,38,38,.35);
  color: rgba(185,28,28,1);
}

 .sidebar a.nav-critical.nav-critical-block{
  margin: 8px 10px;
  padding-left: 16px;
  border-left: 3px solid rgba(220,38,38,.55);
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(254,242,242,.75));
 }
 .sidebar a.nav-critical.nav-critical-block:hover{
  border-left-color: rgba(220,38,38,.75);
  background: linear-gradient(180deg, #fff7f7, #fff1f2);
 }

 .sidebar details.admin-nav{
  border-left-color: rgba(13,148,136,.35);
  background: linear-gradient(180deg, rgba(240,253,250,.9), rgba(255,255,255,.75));
 }
 .sidebar details.admin-nav summary{
  color: rgba(15,118,110,.95);
 }
 .sidebar details.admin-nav details.admin-subnav{
  margin: 6px 10px;
  border: 1px solid rgba(15,118,110,.18);
  border-left: 2px solid rgba(15,118,110,.25);
  border-radius: 12px;
  background: rgba(255,255,255,.55);
 }
 .sidebar details.admin-nav details.admin-subnav summary{
  padding: 10px 12px 10px 16px;
  font-size: 12.4px;
  color: rgba(15,118,110,.9);
 }
 .sidebar details.admin-nav details.admin-subnav summary::before{
  opacity: 0;
 }
 .sidebar details.admin-nav details.admin-subnav[open] summary::before{
  opacity: 0;
 }
 .sidebar details.admin-nav details.admin-subnav a{
  margin-left: 18px;
  margin-right: 10px;
}
 .sidebar details.tutorial-nav details.tutorial-subnav{
  margin: 6px 10px;
  border: 1px solid rgba(79,70,229,.18);
  border-left: 2px solid rgba(79,70,229,.25);
  border-radius: 12px;
  background: rgba(255,255,255,.55);
 }
 .sidebar details.tutorial-nav details.tutorial-subnav summary{
  padding: 10px 12px 10px 16px;
  font-size: 12.4px;
  color: rgba(79,70,229,.9);
 }
 .sidebar details.tutorial-nav details.tutorial-subnav summary::before{
  opacity: 0;
 }
 .sidebar details.tutorial-nav details.tutorial-subnav[open] summary::before{
  opacity: 0;
 }
 .sidebar details.tutorial-nav details.tutorial-subnav a{
  margin-left: 18px;
  margin-right: 10px;
}

/* =========================================================
   ADMIN PORTAL — Professional card layout
   ========================================================= */
.ap{
  max-width: 1060px;
  margin: 0 auto;
  padding: 28px 20px 70px;
  font-family: "Inter", "Noto Sans JP", system-ui, sans-serif;
}

/* Hero */
.ap-hero{
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding: 22px 26px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(111,168,145,.12), rgba(99,102,241,.08)),
    linear-gradient(180deg, #ffffff, #f8fafb);
  border: 1px solid rgba(111,168,145,.18);
  box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.ap-hero-icon{
  flex-shrink: 0;
  width: 60px; height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(111,168,145,.18), rgba(99,102,241,.12));
  color: var(--mint, #6fa891);
}
.ap-hero-title{
  font-size: 22px;
  font-weight: 700;
  color: var(--text, #173326);
  margin: 0 0 4px;
  letter-spacing: -.3px;
}
.ap-hero-sub{
  font-size: 13px;
  color: rgba(71,85,105,.88);
  margin: 0;
  line-height: 1.5;
}

/* Category sections */
.ap-section{
  margin-bottom: 28px;
}
.ap-section-header{
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.ap-section-dot{
  flex-shrink: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
}
.ap-section-title{
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #173326);
  margin: 0;
  letter-spacing: -.2px;
}
.ap-section-desc{
  font-size: 12px;
  color: rgba(71,85,105,.78);
  margin: 2px 0 0;
}

/* Card grid */
.ap-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

/* Card base */
.ap-card{
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.88);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition:
    transform .15s ease,
    box-shadow .18s ease,
    border-color .15s ease,
    background .15s ease;
}
.ap-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,.09);
  border-color: var(--card-accent, rgba(111,168,145,.35));
  background: #fff;
}

/* Icon bubble */
.ap-card-icon{
  flex-shrink: 0;
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(0,0,0,.03);
  transition: background .15s ease;
}
.ap-card:hover .ap-card-icon{
  background: rgba(0,0,0,.06);
}
.ap-card-icon svg{
  display: block;
}

/* Body */
.ap-card-body{
  flex: 1;
  min-width: 0;
}
.ap-card-titles{
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 4px;
}
.ap-card-title{
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(15,23,42,.92);
  letter-spacing: -.15px;
}
.ap-card-title-jp{
  font-size: 11.5px;
  color: rgba(71,85,105,.72);
}
.ap-card-desc{
  font-size: 12px;
  line-height: 1.55;
  color: rgba(71,85,105,.85);
  margin: 0 0 8px;
}

/* Badges */
.ap-card-badge{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
}
.ap-badge-active{
  background: rgba(5,150,105,.1);
  color: #059669;
}
.ap-badge-locked{
  background: rgba(148,163,184,.12);
  color: #94a3b8;
}
.ap-badge-locked svg{
  display: inline-block;
  vertical-align: middle;
}

/* Locked card */
.ap-card.is-locked{
  cursor: not-allowed;
  border-style: dashed;
}
.ap-card.is-locked .ap-card-icon,
.ap-card.is-locked .ap-card-body{
  opacity: .5;
  transition: opacity .2s ease;
}
.ap-card.is-locked:hover{
  transform: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
  border-color: rgba(148,163,184,.35);
  background: rgba(248,250,252,.95);
}

/* Overlay on hover for locked cards */
.ap-card-overlay{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(3px);
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.ap-card.is-locked:hover .ap-card-overlay{
  opacity: 1;
}
.ap-card-overlay-msg{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(15,23,42,.06);
  border: 1px solid rgba(15,23,42,.1);
  font-size: 12.5px;
  color: rgba(15,23,42,.78);
}
.ap-card-overlay-msg svg{
  flex-shrink: 0;
  color: #d97706;
}
.ap-card-overlay-msg strong{
  font-weight: 700;
}

/* Responsive */
@media (max-width: 700px){
  .ap-grid{
    grid-template-columns: 1fr;
  }
  .ap-hero{
    flex-direction: column;
    text-align: center;
  }
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-track { background: rgba(0,0,0,.04); }
.sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(111,168,145,.75), rgba(111,168,145,.35));
  border: 2px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}

/* =========================================================
   Header + Footer (Stable width)
   - Always full width
   - No resizing when sidebar opens/closes
   ========================================================= */

/* ===== Header ===== */
.page-header{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height:53px;
  padding: 0 14px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--text, #173326);
  z-index: 999;

  background:
    linear-gradient(135deg, var(--glass-2, rgba(255,255,255,.70)), var(--glass, rgba(240,249,255,.82))),
    linear-gradient(180deg, rgba(111,168,145,.06), transparent);

  border-bottom: 1px solid var(--line-strong, rgba(111,168,145,.28));
  box-shadow: var(--shadow-soft, 0 6px 18px rgba(0,0,0,.06)),
              var(--shadow-inset, inset 0 0 0 1px rgba(255,255,255,.55));
  backdrop-filter: blur(12px) saturate(120%);

  /* Important: stop width/left animation weirdness */
  transition: height .2s ease, padding .2s ease;
}

/* Keep JS compatibility (no visual change) */
.page-header.full{
  left: 0;
  width: 100%;
}

/* Title */
.path-title{
  font-size: 18px;
  line-height: 1;
  text-align: center;
  color: var(--mint, #6fa891);
  letter-spacing: .4px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.04);

  max-width: 60vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Logo: keep stable position (not tied to sidebar width) */
.logo-title{
  position: fixed;
  top: 10px;
  left: 60px;
  z-index: 1000;
}
.logo-title img{
  width: 108px;
  height: auto;
  opacity: .95;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.06));
}

/* Logout zone */
.logout-container{
  gap: 10px;
  position: fixed;
  top: 8px;
  right: 14px;
  z-index: 1000;
  align-items: center;
  display: flex;
  margin-right: 22px;
}

.user-name{
  color: var(--text, #173326);
  font-size: 12.5px;
  font-weight: 500;
  font-family: "Segoe UI", system-ui, sans-serif;
  opacity: .9;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(111,168,145,.08);
  border: 1px solid rgba(111,168,145,.18);
}

.logout-image-btn{
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.logout-image-btn img{
  width: 34px;
  height: auto;
  display: block;
  border-radius: 10px;
  opacity: 0.9;
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease, filter .18s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  filter: saturate(105%);
}

.logout-image-btn img:hover{
  opacity: 1;
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  filter: saturate(115%);
}



/* ===== Footer ===== */
.app-footer{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-h, 34px);
  padding: 0 10px;

  display: flex;
  justify-content: center;
  align-items: center;

  z-index: 1000;

  background:
    linear-gradient(135deg, var(--glass-2, rgba(255,255,255,.70)), var(--glass, rgba(240,249,255,.82))),
    linear-gradient(0deg, rgba(111,168,145,.06), transparent);

  border-top: 1px solid var(--line-strong, rgba(111,168,145,.28));
  box-shadow: 0 -6px 18px rgba(0,0,0,.05),
              var(--shadow-inset, inset 0 0 0 1px rgba(255,255,255,.55));
  backdrop-filter: blur(12px) saturate(120%);

  transition: height .2s ease, padding .2s ease;
}

/* Keep JS compatibility */
.app-footer.full{
  left: 0;
  width: 100%;
}

.footer-content{
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-logo{
  height: 22px;
  width: auto;
  opacity: 0.88;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.05));
}
.footer-text{
  font-size: 11.5px;
  color: var(--muted, #3b5f50);
  font-weight: 500;
  letter-spacing: .2px;
}
.footer-text .internal-only{
  color: #d83a3a;
  font-weight: 600;
  padding-left: 4px;
}


/* =========================================================
   MAIN CONTENT — keep your existing .full behavior
   ========================================================= */
.main-content {
  margin-left: calc(var(--sb-w) + 4px);
  padding: 120px 30px 60px 30px;
  transition: margin-left .25s ease, padding .25s ease;
}

.main-content.full {
  margin-left: -10px;
  padding: 120px 30px 60px 30px;
}

/* =========================================================
   TOGGLE BUTTON — single definitive style
   ========================================================= */
.toggle-btn {
  position: fixed;
  top: 6px;
  left: 14px;
  z-index: 1001;

  width: 40px;
  height: 40px;

  border: 1px solid rgba(111,168,145,.28);
  cursor: pointer;
  border-radius: 12px;

  color: #0f2a1a;
  font-size: 18px;

  background:
    linear-gradient(135deg, rgba(37,99,235,.14), rgba(111,168,145,.28)),
    linear-gradient(180deg, #ffffff, #f2fbf6);

  box-shadow:
    0 8px 18px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.85);

  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;

  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(37,99,235,.28);
  box-shadow:
    0 12px 24px rgba(0,0,0,.14),
    0 0 0 3px rgba(37,99,235,.08);
}

/* =========================================================
   RESPONSIVE LAYOUT (Fixed)
   - Sidebar width can change per breakpoint
   - Header/Footer never change width/left
   ========================================================= */

@media (min-width: 1280px) {
  .sidebar { width: var(--sb-w-lg); }
  .main-content { margin-left: calc(var(--sb-w-lg) + 6px); }
}

@media (max-width: 1180px) {
  .sidebar { width: var(--sb-w-md); }
  .main-content { margin-left: calc(var(--sb-w-md) + 4px); }
}

/* Tablet/Phone: overlay sidebar, content full width */
@media (max-width: 900px) {
  .sidebar {
    width: var(--sb-w-mobile);
    top: var(--sb-top);
    bottom: 0;
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
    box-shadow:
      10px 0 30px rgba(0,0,0,.16),
      inset 0 1px 0 rgba(255,255,255,.75);
  }

  .main-content,
  .main-content.full {
    margin-left: 0 !important;
  }

  .toggle-btn {
    width: 44px;
    height: 44px;
    font-size: 19px;
  }
}

@media (max-width: 420px) {
  .sidebar { padding: 12px 10px 16px; }
  .sidebar summary { padding: 9px 10px; }
  .sidebar a { padding: 8px 10px 8px 20px; }
}


/* =========================================================
   BUTTONS (Request Navigation)
   ========================================================= */
.buttons-container {
  display: inline-grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  margin-top: -50px;
  padding: 10px;
}

/* Request nav cards */
.btn-nav {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;

  width: 225px;
  height: 50px;
  padding: 14px 16px;

  background: linear-gradient(180deg, #f1f1f1, #daebe1);
  border-radius: 12px;
  border: 1px solid #ddd;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.2s ease;

  font-family: 'Helvetica Neue', sans-serif;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none !important;
}

.btn-nav::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  transition: background-color 0.3s ease;
}

.btn-nav span {
  font-size: 18px;
  font-weight: 400;
  color: #407c48;
  text-align: left;
  line-height: 1.5;
}

.btn-nav:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.08);
}

/* Color tags by type */
.btn-nav.work-home::before { background-color: #007acc; }
.btn-nav.purchase::before { background-color: #8854d0; }
.btn-nav.entertainment::before { background-color: #eb3b5a; }
.btn-nav.social::before { background-color: #20bf6b; }
.btn-nav.other-expense::before { background-color: #0fb9b1; }
.btn-nav.order-request::before { background-color: #fa8231; }
.btn-nav.hiring::before { background-color: #4b7bec; }
.btn-nav.current_check::before { background-color: #26de81; }
.btn-nav.requests_archives::before { background-color: #a5b1c2; }
.btn-nav.check_all::before { background-color: #3867d6; }

/* =========================================================
   FORMS
   ========================================================= */
.form-wrapper {
  background: linear-gradient(180deg, #f1f1f1, #daebe1);
  padding: 25px 30px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  max-width: 1400px;
  margin: 0 auto 20px auto;
  border: 1px solid rgba(210, 220, 229, 0.5);
}

.form-wrapper label {
  display: block;
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 8px;
  color: #2c3e5a;
  max-width: 1000px;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  border: 1px solid #e0e6ed;
  border-radius: 12px;
  background-color: #f8fafc;
  color: #333;
  margin-bottom: 24px;
  transition: all 0.2s ease-in-out;
}

.form-control:focus {
  outline: none;
  border-color: #3a86ff;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.15);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 0px;
}

.form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0px;
}

/* Generic form elements (kept) */
form .form-control,
form select,
form input[type="text"],
form input[type="date"],
form input[type="number"],
form textarea {
  background-color: #f8fafc;
  width: 100%;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid #d5e7e0;
  font-size: 15px;
  box-sizing: border-box;
}

/* Submit buttons */
.btn-submit {
  background: linear-gradient(135deg, var(--mint), var(--mint-deep));
  color: white;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: block;
  margin: 0px auto 0 auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, var(--mint-deep), var(--mint));
}

.btn-submit:active { transform: scale(0.98); }

/* Disabled submit */
.disabled-btn {
  background: linear-gradient(180deg, #d1d1d1, #8d8e8d);
  color: #333333;
  padding: 14px 32px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: block;
  margin: 0px auto 0 auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

/* Misc */
.muted {
  color: #6c757d;
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid #e9ecef;
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gradientWave 15s ease infinite;
}

.login-container {
  max-width: 480px;
  width: 100%;
  padding: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
  text-align: center;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-logo {
  width: 260px;
  margin-bottom: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e5a;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.login-container input,
.login-container textarea {
  width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid #e0e6ed;
  font-size: 15px;
  background: #f8fafc;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.login-container input:focus {
  border-color: #1a6d1e !important;
  box-shadow: 0 0 0 3px rgba(96, 216, 132, 0.15);
}

.login-container button {
  width: 100%;
  padding: 14px 16px;
  margin-top: 10px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--mint), var(--mint-deep));
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.login-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, var(--mint-deep), var(--mint));
}

/* Message blocks */
.message {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}

.success {
  background-color: #edf7ed;
  color: #1e4620;
  border-color: #c8e6c9;
}
.danger {
  background-color: #fdecea;
  color: #5f2120;
  border-color: #ffcdd2;
}

/* =========================================================
   CHECK REQUESTS UI
   ========================================================= */
.expander summary {
  font-size: 1.1rem;
  padding: 10px 20px;
  background: linear-gradient(180deg, #dde7e136, #c3d9cc86);
  border: 1px solid #e0e6ed;
  border-radius: 10px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.expander summary:hover {
  background: linear-gradient(180deg, #c3d9cc86, #dde7e136);
}

.request-details {
  background: #fff;
  border: 1px solid #e0e6ed;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Status labels */
.status-label {
  padding: 6px 12px;
  font-size: 0.9rem;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  display: inline-block;
}

.label-rejected { background-color: #ef4444; }
.label-approved { background-color: #10b981; }
.label-canceled { background-color: #f97316; }
.label-pending  { background-color: #64748b; }

.text-rejected { color: #ef4444; }
.text-approved { color: #10b981; }
.text-canceled { color: #f97316; }
.text-pending  { color: #64748b; }

/* Action buttons */
.btn-download,
.btn-cancel {
  margin-top: 10px;
  background-color: #3a86ff;
  color: white;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-download:hover {
  background-color: #2667cc;
  transform: translateY(-1px);
}

.btn-cancel {
  background-color: #ef4444;
}
.btn-cancel:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
}

textarea.form-control {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
  border: 1px solid #e0e6ed;
  border-radius: 10px;
  background-color: #f8fafc;
  resize: vertical;
}

/* Approver badges */
.badge-container {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approver-badge {
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 16px;
  color: white;
  background-color: #64748b;
  display: inline-block;
}

.approver-badge.accepted { background-color: #10b981; }
.approver-badge.rejected { background-color: #ef4444; }
.approver-badge.pending  { background-color: #fbbf24; color: #333; }
.approver-badge.skipped  { background-color: #60a5fa; }

.request-details-check-request {
  background: linear-gradient(180deg, #f1f1f1, #daebe1);
  padding: 20px;
  border-radius: 12px;
  margin-top: -5px;
  margin-bottom: 15px;
  font-size: 0.95rem;
  line-height: 1.6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: background-color 0.3s ease;
  border: 1px solid #e0e6ed;
}

/* =========================================================
   MODALS (Unified)
   - Used by decline popout & loading modal
   ========================================================= */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;

  background-color: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}

/* One flexible modal content */
.modal-content {
  background-color: #fff;
  margin: 10vh auto 0;
  padding: 28px;
  border: none;
  width: min(420px, 92vw);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  position: relative;
  text-align: center;
}

/* Close button */
.close,
.modal-content .close {
  position: absolute;
  right: 20px;
  top: 16px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: #64748b;
  transition: color 0.2s ease;
}
.close:hover,
.modal-content .close:hover {
  color: #334155;
}

/* Modal actions */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* Modal textarea */
.modal-content textarea {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  resize: vertical;
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  background: #f8fafc;
}

/* Loading spinner */
.loading-spinner {
  border: 4px solid #f1f5f9;
  border-top: 4px solid #3a86ff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin: 20px auto;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modal close button (blue) */
.btn-modal-close {
  margin-top: 20px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  background: linear-gradient(135deg, #3a86ff 0%, #2667cc 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-modal-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Trash Button */
.btn-delete {
  background-color: #ef4444;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-top: -25px;
  margin-right: -130px;
  position: relative;
  vertical-align: middle;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.btn-delete:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
}

/* Shared action base */
.btn-action {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Approve/Decline/Skip/Transfer */
.btn-approve {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}
.btn-approve:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-decline {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}
.btn-decline:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.btn-skip {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  color: white;
}
.btn-skip:hover {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.btn-transfer {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}
.btn-transfer:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* Restore/Delete icons */
.archive-btn-restore,
.archive-btn-delete {
  border: none;
  background: none;
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: 8px;
  padding: 4px;
  transition: all 0.2s ease;
  color: #64748b;
}
.archive-btn-restore:hover {
  color: #3a86ff;
  transform: scale(1.1);
}
.archive-btn-delete:hover {
  color: #ef4444;
  transform: scale(1.1);
}

/* =========================================================
   MANAGE USERS
   ========================================================= */
.user-card-slim {
  border: 1px solid #e0e6ed;
  border-radius: 12px;
  margin-bottom: 1rem;
  padding: 1.25rem;
  background: linear-gradient(180deg, #ffffff, #c3d9cc);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.user-card-slim:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  color: #2c3e5a;
}

.user-card-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-line,
.btn-line-danger {
  border: 1px solid #e0e6ed;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-line:hover {
  background-color: #f1f5f9;
  transform: translateY(-1px);
}

.btn-line-danger {
  color: #ef4444;
  border-color: #ef4444;
}
.btn-line-danger:hover {
  background-color: #fee2e2;
  transform: translateY(-1px);
}

.user-card-form {
  display: none;
  margin-top: 1rem;
  border-top: 1px solid #f1f5f9;
  padding-top: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.form-access-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* =========================================================
   FLASH ANIMATION
   ========================================================= */
.custom-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.10);
  backdrop-filter: blur(10px);
  max-width: min(760px, calc(100vw - 40px));
  margin: 0 auto 10px;
  color: #0f172a;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .35s ease, transform .35s ease;
}

.custom-alert .icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(15, 23, 42, 0.03);
  line-height: 1;
}

.custom-alert .message {
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(15, 23, 42, 0.90);
  word-break: break-word;
}

.custom-alert.alert-success {
  border-color: rgba(16, 185, 129, 0.25);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(255, 255, 255, 0.92));
}

.custom-alert.alert-danger {
  border-color: rgba(239, 68, 68, 0.25);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(255, 255, 255, 0.92));
}

.custom-alert.alert-warning {
  border-color: rgba(245, 158, 11, 0.30);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(255, 255, 255, 0.92));
}

.custom-alert.alert-info {
  border-color: rgba(37, 99, 235, 0.24);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(255, 255, 255, 0.92));
}

.custom-alert.alert-success .icon {
  border-color: rgba(16, 185, 129, 0.24);
  background: rgba(16, 185, 129, 0.10);
}

.custom-alert.alert-danger .icon {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.10);
}

.custom-alert.alert-warning .icon {
  border-color: rgba(245, 158, 11, 0.26);
  background: rgba(245, 158, 11, 0.12);
}

.custom-alert.alert-info .icon {
  border-color: rgba(37, 99, 235, 0.20);
  background: rgba(37, 99, 235, 0.10);
}

.custom-alert.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

/* =========================================================
   REMINDER NAV BUTTONS
   ========================================================= */
.nav-buttons-reminder {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.nav-btn-rem {
  padding: 10px 20px;
  background: linear-gradient(181deg, #f7fafc, #dde7e1);
  color: #407c48;
  text-decoration: none;
  font-weight: 600;
  border-radius: 8px;
  border-color: #6fa8919c;
  transition: all 0.2s ease;
}

.nav-btn-rem:hover {
  background: linear-gradient(181deg, #dde7e1, #f7fafc);
}

.nav-btn-rem.active {
  background: linear-gradient(181deg, #dde7e178, #64998391);
  border-color: #6fa8919c;
  box-shadow: 0 3px 14px #7baf90;
  color: #2e6335;
}

/* =========================================================
   COMPACT APPROVER BREADCRUMB
   ========================================================= */
:root {
  --ap-bd:#e5e7eb;
  --ap-tx:#374151;
  --ap-muted:#6b7280;
  --ap-bg:#fff;
  --ap-chip:#f8fafc;
}

.appr-wrap { margin: 6px 0; }
.appr-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.appr-label { color: var(--ap-muted); font-size: 12px; }
.appr-sep { opacity: .5; }

.appr-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--ap-bd);
  border-radius: 999px;
  background: var(--ap-chip);
  color: var(--ap-tx);
  font-size: 12px;
  line-height: 18px;
  max-width: 100%;
  white-space: nowrap;
}
.appr-name { font-weight: 600; background: var(--ap-bg); }
.appr-meta {
  display: inline-flex;
  gap: 6px;
  color: var(--ap-muted);
  font-size: 12px;
}
.appr-mode {
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--ap-bd);
  border-radius: 999px;
  background: var(--ap-bg);
  font-size: 12px;
  color: var(--ap-tx);
}

/* subtle mode tints */
.appr-mode[data-mode="全員承認［左→右］"] { background:#eef2ff; }
.appr-mode[data-mode="全員承認順不同"] { background:#ecfeff; }
.appr-mode[data-mode="誰でも承認"] { background:#f0fdf4; }
.appr-mode[data-mode="上位承認者優先［右が上位］"] { background:#fff7ed; }

.appr-hint {
  color: var(--ap-muted);
  font-size: 11px;
  margin-left: 52px;
}

@media (max-width: 640px) {
  .appr-mode { margin-left: 0; }
}
