@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --em:          #00b37a;
  --em-mid:      #009968;
  --em-dark:     #007a52;
  --em-light:    #e6f7f1;
  --red:         #e8304a;
  --red-light:   #fff0f3;
  --blue:        #4361ee;
  --blue-light:  #eef0ff;
  --amber:       #f59e0b;
  --amber-light: #fffbeb;
  --purple:      #7c3aed;
  --purple-light:#f5f3ff;
  --black:       #1a1a2e;
  --gray-700:    #374151;
  --gray-600:    #4b5563;
  --gray-500:    #6b7280;
  --gray-400:    #9ca3af;
  --gray-300:    #d1d5db;
  --gray-200:    #e5e7eb;
  --gray-100:    #f3f4f6;
  --gray-50:     #f9fafb;
  --white:       #ffffff;
  --bg:          #f0f0f8;
  --sidebar-w:   200px;
  --font-body:   'Noto Sans JP', sans-serif;
  --font-num:    'Inter', sans-serif;
  --radius:      10px;
  --radius-lg:   14px;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ═══════════════════════════════
   AUTH LAYOUT
═══════════════════════════════ */
.layout-auth { background: var(--bg); }

.auth-wrapper {
  display: grid;
  grid-template-columns: 1fr 460px;
  min-height: 100vh;
}

.auth-left {
  background: var(--black);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 52px 60px; position: relative; overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(0,179,122,.18) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 20%, rgba(67,97,238,.12) 0%, transparent 60%);
  pointer-events: none;
}

.auth-left::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.auth-left-logo {
  font-family: var(--font-num);
  font-size: 24px; font-weight: 800;
  color: var(--white); letter-spacing: -.5px;
  position: relative; z-index: 1;
  opacity: 0; animation: fadeUp .5s .1s ease forwards;
}
.auth-left-logo em { color: var(--em); font-style: normal; }

.auth-left-tag {
  display: inline-block;
  background: rgba(0,179,122,.15); border: 1px solid rgba(0,179,122,.25);
  color: var(--em); font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  padding: 3px 12px; border-radius: 20px; margin-top: 10px;
}

.auth-left-body { position: relative; z-index: 1; }

.auth-headline {
  font-family: var(--font-num);
  font-size: clamp(36px, 4vw, 52px); font-weight: 900;
  line-height: 1.1; color: var(--white); letter-spacing: -2px;
  margin-bottom: 20px;
  opacity: 0; animation: fadeUp .6s .25s ease forwards;
}
.auth-headline em { color: var(--em); font-style: normal; }

.auth-desc {
  font-size: 13.5px; line-height: 1.85;
  color: rgba(255,255,255,.4);
  opacity: 0; animation: fadeUp .6s .35s ease forwards;
}

.auth-stats {
  display: flex; gap: 36px; padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,.08);
  position: relative; z-index: 1;
  opacity: 0; animation: fadeUp .6s .45s ease forwards;
}
.auth-stats .stat-num {
  font-family: var(--font-num);
  font-size: 30px; font-weight: 900; color: var(--em);
  line-height: 1; letter-spacing: -1px; margin-bottom: 4px;
}
.auth-stats .stat-label { font-size: 11px; color: rgba(255,255,255,.35); font-weight: 500; }

.auth-right {
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  padding: 56px 48px; border-left: 1px solid var(--gray-200);
}

.auth-form-wrap { width: 100%; max-width: 340px; }

.auth-form-logo {
  font-family: var(--font-num); font-size: 20px; font-weight: 800;
  color: var(--black); letter-spacing: -.5px; margin-bottom: 32px;
  opacity: 0; animation: fadeUp .5s .15s ease forwards;
}
.auth-form-logo em { color: var(--em); font-style: normal; }

.auth-form-title {
  font-family: var(--font-num); font-size: 22px; font-weight: 800;
  letter-spacing: -.5px; color: var(--black); margin-bottom: 6px;
  opacity: 0; animation: fadeUp .5s .2s ease forwards;
}

.auth-form-sub {
  font-size: 13px; color: var(--gray-500);
  margin-bottom: 28px; line-height: 1.7;
  opacity: 0; animation: fadeUp .5s .25s ease forwards;
}

@media (max-width: 768px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 40px 24px; }
}

/* ═══════════════════════════════
   APP LAYOUT
═══════════════════════════════ */
.layout-app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}

.sidebar-logo {
  padding: 15px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 7px;
}

.sidebar-logo-text {
  font-family: var(--font-num);
  font-size: 16px; font-weight: 800;
  color: var(--black); letter-spacing: -.5px;
}
.sidebar-logo-text em { color: var(--em); font-style: normal; }

.sidebar-logo-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--em-dark); background: var(--em-light);
  padding: 2px 6px; border-radius: 4px;
}

.sidebar-nav { flex: 1; padding: 6px 0; }

.sidebar-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gray-400); padding: 12px 16px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; color: var(--gray-600);
  font-size: 13px; font-weight: 500; text-decoration: none;
  cursor: pointer; transition: background .1s, color .1s;
  position: relative;
}
.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: var(--gray-50); color: var(--black); }
.nav-item.active {
  color: var(--em-dark); font-weight: 700;
  background: var(--em-light);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 5px; bottom: 5px;
  width: 3px; background: var(--em); border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 8px;
}

.sidebar-user { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.sidebar-user-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--em), #22d3ee);
  color: var(--white); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-num); font-size: 12px; font-weight: 800; flex-shrink: 0;
}

.sidebar-user-name { font-size: 12px; font-weight: 700; color: var(--black); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: var(--gray-400); }

.btn-logout {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); padding: 5px; border-radius: 5px;
  display: flex; align-items: center; transition: color .1s, background .1s;
}
.btn-logout:hover { color: var(--red); background: var(--red-light); }

/* ── Main ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }

.page-header-bar {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 28px; height: 50px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.page-title {
  font-family: var(--font-num);
  font-size: 15px; font-weight: 800; letter-spacing: -.3px; color: var(--black);
}

.page-sub { font-size: 11px; color: var(--gray-400); margin-top: 1px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-inner { padding: 36px 44px; max-width: 1080px; }

/* ═══════════════════════════════
   FLASH
═══════════════════════════════ */
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-radius: 8px;
  margin-bottom: 18px; font-size: 13px; font-weight: 600;
}
.flash-success { background: var(--em-light); color: var(--em-dark); border: 1px solid #a7f3d0; }
.flash-error   { background: var(--red-light); color: var(--red); border: 1px solid #fecdd3; }
.flash-close   { background: none; border: none; cursor: pointer; font-size: 18px; color: inherit; opacity: .4; line-height: 1; }

/* ═══════════════════════════════
   STATS CARDS — Qoo10スタイル
═══════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 18px;
}

.stat-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px 18px;
  transition: box-shadow .2s; position: relative; overflow: hidden;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }

/* 上部カラーライン */
.stat-card-line {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--em);
}
.stat-card-line.red    { background: var(--red); }
.stat-card-line.blue   { background: var(--blue); }
.stat-card-line.amber  { background: var(--amber); }
.stat-card-line.purple { background: var(--purple); }
.stat-card-line.gray   { background: var(--gray-300); }

.stat-card-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em;
}

.stat-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--em);
}
.stat-dot.red    { background: var(--red); }
.stat-dot.blue   { background: var(--blue); }
.stat-dot.amber  { background: var(--amber); }
.stat-dot.purple { background: var(--purple); }
.stat-dot.gray   { background: var(--gray-400); }

.stat-card-num {
  font-family: var(--font-num);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -1.5px;
  color: var(--black);
  margin-bottom: 8px;
}

.stat-card-num.em     { color: var(--em-dark); }
.stat-card-num.red    { color: var(--red); }
.stat-card-num.blue   { color: var(--blue); }
.stat-card-num.purple { color: var(--purple); }
.stat-card-num.small  { font-size: 22px; letter-spacing: -.8px; }
.stat-card-num.xsmall { font-size: 18px; letter-spacing: -.5px; }

.stat-card-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; flex-wrap: wrap;
}

.delta-up   { color: var(--em-dark); }
.delta-down { color: var(--red); }
.delta-label { color: var(--gray-400); font-weight: 500; }

.stat-action { color: var(--em-dark); border-bottom: 1px solid var(--em-light); font-size: 11px; font-weight: 600; cursor: pointer; transition: color .15s; }
.stat-action:hover { color: var(--em); }

/* ═══════════════════════════════
   SECTION CARD
═══════════════════════════════ */
.section-card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 14px;
}

.section-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 20px; border-bottom: 1px solid var(--gray-100);
}

.section-card-title {
  font-family: var(--font-num); font-size: 13px; font-weight: 800; letter-spacing: -.2px;
}

/* ═══════════════════════════════
   TABLE
═══════════════════════════════ */
.table { width: 100%; border-collapse: collapse; }

.table th {
  padding: 9px 18px; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gray-400); background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}

.table td { padding: 12px 18px; border-bottom: 1px solid var(--gray-100); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }
.td-title { font-weight: 700; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-num { font-family: var(--font-num); font-weight: 800; letter-spacing: -.3px; }
.td-actions { display: flex; gap: 5px; white-space: nowrap; }

/* ═══════════════════════════════
   BADGES
═══════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: .02em;
}
.badge-open      { background: var(--em-light);    color: var(--em-dark); }
.badge-draft     { background: var(--gray-100);    color: var(--gray-500); }
.badge-closed    { background: var(--amber-light); color: var(--amber); }
.badge-completed { background: var(--blue-light);  color: var(--blue); }
.badge-cancelled { background: var(--red-light);   color: var(--red); }
.badge-pending   { background: var(--amber-light); color: var(--amber); }
.badge-approved  { background: var(--em-light);    color: var(--em-dark); }
.badge-rejected  { background: var(--red-light);   color: var(--red); }
.badge-waiting   { background: var(--gray-100);    color: var(--gray-500); }
.badge-preparing { background: #ecfeff;            color: #0e7490; }
.badge-shipped   { background: var(--blue-light);  color: var(--blue); }
.badge-delivered { background: var(--em-light);    color: var(--em-dark); }
.badge-selected  { background: var(--em-light);    color: var(--em-dark); }

/* ═══════════════════════════════
   FORMS
═══════════════════════════════ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gray-600); margin-bottom: 6px; }
.field input[type="text"],.field input[type="email"],.field input[type="password"],.field input[type="number"],.field input[type="date"],.field select,.field textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-family: var(--font-body); font-size: 13px; color: var(--black); background: var(--white);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus,.field select:focus,.field textarea:focus { border-color: var(--em); box-shadow: 0 0 0 3px rgba(0,179,122,.1); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 40px; }
.pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--gray-300); display: flex; padding: 4px; transition: color .15s; }
.pw-toggle:hover { color: var(--black); }
.field-meta { display: flex; justify-content: flex-end; margin-top: 5px; }
.field-check { display: flex; align-items: center; gap: 7px; margin-bottom: 18px; font-size: 12px; color: var(--gray-500); }
.field-check input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--em); cursor: pointer; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.checkbox-group { display: flex; gap: 20px; flex-wrap: wrap; padding: 6px 0; }
.checkbox-item { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.checkbox-item input { width: 14px; height: 14px; accent-color: var(--em); }

/* ═══════════════════════════════
   BUTTONS
═══════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 36px; padding: 0 18px;
  background: var(--em); color: var(--white);
  border: none; border-radius: 8px;
  font-family: var(--font-body); font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--em-mid); box-shadow: 0 4px 12px rgba(0,179,122,.3); }
.btn-block { width: 100%; height: 44px; font-size: 14px; border-radius: 10px; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 36px; padding: 0 16px;
  background: var(--white); color: var(--gray-700);
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: border-color .15s, background .15s;
}
.btn-secondary:hover { border-color: var(--gray-400); background: var(--gray-50); }
.btn-danger { background: var(--red); color: var(--white); border: none; }
.btn-danger:hover { background: #c92040; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 11px; border-radius: 6px; }
.btn-group { display: flex; gap: 8px; }

/* ═══════════════════════════════
   MISC
═══════════════════════════════ */
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; line-height: 1.6; font-weight: 600; }
.alert-error { background: var(--red-light); border: 1px solid #fecdd3; color: var(--red); }
.link { border-bottom: 1px solid currentColor; }
.link-muted { color: var(--gray-400); font-size: 12px; font-weight: 600; transition: color .14s; }
.link-muted:hover { color: var(--black); }
.empty-state { padding: 48px 24px; text-align: center; color: var(--gray-400); }
.empty-state p { margin-bottom: 16px; font-size: 13px; font-weight: 600; }
.required { color: var(--red); font-size: 11px; }

.form-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 36px 40px; }
.form-section { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--gray-100); }
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { font-family: var(--font-num); font-size: 13px; font-weight: 800; letter-spacing: -.2px; color: var(--black); margin-bottom: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

.filter-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--gray-200); }
.filter-tab { padding: 8px 16px; font-size: 12px; font-weight: 700; color: var(--gray-500); border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer; text-decoration: none; transition: color .14s, border-color .14s; margin-bottom: -1px; }
.filter-tab:hover { color: var(--black); }
.filter-tab.active { color: var(--em-dark); border-bottom-color: var(--em); }

.detail-grid { display: grid; grid-template-columns: 1fr 260px; gap: 14px; align-items: start; }
.detail-body { padding: 20px; }
.detail-list { display: grid; grid-template-columns: 100px 1fr; gap: 10px 14px; font-size: 13px; }
.detail-list dt { color: var(--gray-500); font-weight: 600; }
.detail-list dd { color: var(--black); font-weight: 700; }

.quick-links { display: flex; flex-direction: column; }
.quick-link-item { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; font-size: 13px; font-weight: 600; color: var(--black); text-decoration: none; transition: background .14s; border-bottom: 1px solid var(--gray-100); }
.quick-link-item:last-child { border-bottom: none; }
.quick-link-item:hover { background: var(--gray-50); }
.quick-link-arrow { color: var(--gray-300); font-size: 16px; }

.quick-amounts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.quick-amount-btn { height: 36px; padding: 0 14px; border: 1.5px solid var(--gray-200); border-radius: 8px; background: var(--white); font-family: var(--font-body); font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.quick-amount-btn:hover { border-color: var(--em); color: var(--em-dark); background: var(--em-light); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}