* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #faf7f2; --surface: #ffffff; --border: #ece5da;
  --text: #241d14; --muted: #7a7062;
  --accent: #ff930d; --accent-dark: #e07e00; --accent-text: #b05e00;
  --accent-soft: #fff1e0;
  --ok-bg: #e5f4ec; --ok-text: #14683c;
  --err-bg: #fbe9e9; --err-text: #9c2121;
  --radius: 8px;
}
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
}

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 16px 12px;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand span { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.nav-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); padding: 14px 10px 4px;
}
.nav-link {
  display: block; padding: 7px 10px; border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.nav-link:hover { background: var(--bg); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}
.topbar .spacer { flex: 1; }
.product-switch select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); font-size: 14px;
}
.content { padding: 24px; max-width: 960px; }

h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
h2 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }
.muted { color: var(--muted); }

.cards { display: flex; flex-wrap: wrap; gap: 12px; }
.card {
  display: block; width: 220px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text);
}
.card:hover { border-color: var(--accent); }
.card-title { font-weight: 600; }
.card-sub { font-size: 13px; color: var(--muted); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); font-size: 14px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent-text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-link {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 4px;
}
.btn-link:hover { color: var(--text); }

.flash { margin: 12px 24px 0; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.err { background: var(--err-bg); color: var(--err-text); }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.err { background: var(--err-bg); color: var(--err-text); }

.inline-form { display: flex; gap: 8px; margin: 14px 0; }
.inline-form input[type="text"] {
  flex: 1; max-width: 420px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px;
}
.note-list { list-style: none; }
.note-list li {
  display: flex; justify-content: space-between; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 8px;
}

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  width: 340px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px;
}
.login-logo { display: block; width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 14px; }
.login-card h1 { text-align: center; margin-bottom: 18px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login-card input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px;
}
.login-card .btn { width: 100%; margin-top: 18px; }
.login-card .flash { margin: 0 0 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 20px; }
.tab { padding: 7px 14px; color: var(--muted); text-decoration: none; border-radius: var(--radius) var(--radius) 0 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom: 2px solid var(--accent); font-weight: 500; }
.card:hover { border-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent) !important; }

.stack-form { display: flex; flex-direction: column; gap: 10px; max-width: 640px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stack-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1; }
.stack-form input, .stack-form select, .stack-form textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; color: var(--text); }
.form-row { display: flex; gap: 12px; align-items: flex-end; }

.draft-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px; max-width: 720px; }
.draft-card textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; font-family: inherit; }
.draft-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.draft-card .actions { margin-top: 10px; }
.charcount { font-size: 12px; }

.widget-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.widget { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; width: 220px; cursor: grab; }
.widget.wide { width: 100%; max-width: 600px; }
.widget.dragging { opacity: 0.5; }
.widget-head { display: flex; justify-content: space-between; align-items: center; }
.widget-title { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 600; margin: 4px 0; }
.line-chart { width: 100%; height: auto; margin: 6px 0; }

.inline-form.compact input { padding: 4px 8px; font-size: 13px; }
.inline-form select, .inline-form input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; }
