/* ═══════════════════════════════════════════
   ZY-ZPZ Design System — Industrial Precision
   ═══════════════════════════════════════════ */

:root {
  /* ── Palette ── */
  --color-bg: #f2efe8;
  --color-surface: #ffffff;
  --color-primary: #1a2634;
  --color-primary-light: #2c3e50;
  --color-accent: #c97d4e;
  --color-accent-light: #e8996a;
  --color-depal: #3b7a9e;
  --color-depal-light: #eaf1f6;
  --color-box: #3a8a5c;
  --color-box-light: #e8f3ed;
  --color-text: #1a2634;
  --color-text-secondary: #5e6b7e;
  --color-text-muted: #8e99ab;
  --color-border: #e8e4dc;
  --color-border-light: #f0ece4;
  --color-danger: #c0392b;
  --color-warning: #d4a017;
  --color-success: #2d7d4e;
  --color-info: #3b7a9e;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --shadow-xl: 0 24px 60px rgba(0,0,0,0.12);

  /* ── Radii ── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* ── Typography ── */
  --font-body: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* ── Transitions ── */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-light); }

/* ── Navigation ── */
.nav-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 10px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  width: 100%; max-width: 1200px; margin: 0 auto 20px;
}
.nav-logo {
  font-weight: 800; font-size: 1.05rem;
  color: var(--color-primary);
  letter-spacing: -0.03em;
}
.nav-logo span { color: var(--color-accent); }
.current-biz {
  background: var(--color-primary); color: #fff; font-size: 0.72rem; font-weight: 700;
  padding: 4px 14px; border-radius: var(--radius-full);
  letter-spacing: 0.02em; white-space: nowrap;
}
.flow-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.flow-links a {
  color: var(--color-text-muted); text-decoration: none; font-size: 0.78rem;
  padding: 4px 10px; border-radius: var(--radius-sm); transition: var(--transition-fast);
}
.flow-links a:hover { background: var(--color-border-light); color: var(--color-text); }
.flow-links a.active { background: var(--color-primary); color: #fff; }
.flow-links a.active-depal { background: var(--color-depal); color: #fff; }
.flow-links a.active-box { background: var(--color-box); color: #fff; }
.flow-arrow { color: var(--color-text-muted); font-size: 0.7rem; }
.user-info { font-size: 0.82rem; color: var(--color-text-secondary); display: flex; align-items: center; gap: 14px; }
.user-info a { text-decoration: none; }
.user-info a:hover { text-decoration: underline; }

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: 12px; margin-bottom: 16px;
}
.card-title { font-weight: 700; font-size: 0.95rem; color: var(--color-primary); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 24px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.85rem; font-family: inherit;
  border: none; cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-light); }
.btn-depal { background: var(--color-depal); color: #fff; }
.btn-depal:hover { background: #2e6584; }
.btn-box { background: var(--color-box); color: #fff; }
.btn-box:hover { background: #2e724b; }
.btn-accent { background: var(--color-accent); color: #fff; }
.btn-accent:hover { background: #b86a3e; }
.btn-outline { background: transparent; color: var(--color-text); border: 1.5px solid var(--color-border); }
.btn-outline:hover { background: var(--color-border-light); border-color: var(--color-text-muted); }
.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-border-light); color: var(--color-text); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #24663f; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #a03226; }
.btn-warning { background: var(--color-warning); color: #fff; }
.btn-warning:hover { background: #b8890a; }
.btn-sm { padding: 6px 16px; font-size: 0.78rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }

/* ── Forms ── */
.form-group { margin-bottom: 4px; }
.form-group label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--color-text-secondary); margin-bottom: 4px;
}
form select, form input, form textarea,
select.form-input, input.form-input, textarea.form-input {
  width: 100%; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  font-size: 0.85rem; font-family: inherit; background: var(--color-surface);
  transition: var(--transition-fast);
  color: var(--color-text);
}
select.form-input:focus, input.form-input:focus, textarea.form-input:focus,
form select:focus, form input:focus, form textarea:focus {
  border-color: var(--color-depal); outline: none;
  box-shadow: 0 0 0 3px rgba(59,122,158,0.1);
}
textarea.form-input, form textarea { resize: vertical; min-height: 50px; }
.config-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px; margin-bottom: 16px;
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: 600;
}
.badge-draft { background: #f0ece4; color: var(--color-text-secondary); }
.badge-reviewing { background: #fef6e0; color: #8a6d0b; }
.badge-approved { background: #e4f3ea; color: var(--color-success); }

/* ── Status Dot ── */
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.status-dot.draft { background: var(--color-text-muted); }
.status-dot.reviewing { background: var(--color-warning); }
.status-dot.approved { background: var(--color-success); }

/* ── Modals ── */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: var(--color-surface); border-radius: var(--radius-xl);
  padding: 24px 28px; max-width: 640px; width: 92%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-xl); position: relative;
  animation: slideUp 0.3s ease;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px; margin-bottom: 8px;
}
.modal-close {
  background: none; border: none; font-size: 1.6rem;
  color: var(--color-text-muted); cursor: pointer;
  line-height: 1; padding: 4px 8px; border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.modal-close:hover { background: var(--color-border-light); color: var(--color-text); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--color-primary); color: #fff;
  padding: 12px 24px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px);
  transition: var(--transition-slow); z-index: 9999;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Section Title ── */
.section-title {
  font-size: 1.05rem; font-weight: 700; color: var(--color-primary);
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border-light);
  display: flex; align-items: center; gap: 8px;
}

/* ── Empty State ── */
.empty-state {
  color: var(--color-text-muted); text-align: center;
  padding: 40px 20px; font-size: 0.9rem;
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.4s ease; }
.stagger-1 { animation: slideUp 0.4s ease 0.05s both; }
.stagger-2 { animation: slideUp 0.4s ease 0.1s both; }
.stagger-3 { animation: slideUp 0.4s ease 0.15s both; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .config-grid { grid-template-columns: 1fr 1fr; }
}
