:root {
  --bg: #f0f4fa;
  --surface: #ffffff;
  --surface-2: #e8eef8;
  --border: #d0daea;
  --text: #0e1c2e;
  --text-2: #4a5e78;
  --navy: #0f2040;
  --accent: #1e3a8a;
  --accent-dim: #eef2ff;
  --green: #2e7d5e;
  --green-dim: #d4f0e5;
  --red: #b83232;
  --red-dim: #fce8e8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hidden { display: none !important; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; width: 320px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { font-size: 1.3rem; margin: 0; }
.login-sub { color: var(--text-2); font-size: 13px; margin: 0 0 8px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.login-card input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.login-error { background: #fff0f0; border: 1px solid #f5c6c6; color: #c0392b; font-size: 12.5px; border-radius: 7px; padding: 8px 12px; }

/* Shell */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
  background: var(--navy); color: #fff; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.app-title { font-weight: 700; }
.app-header-right { display: flex; align-items: center; gap: 12px; font-size: 13px; }

.tab-nav { background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 4px; padding: 0 16px; }
.tab-btn {
  background: none; border: none; padding: 12px 16px; font-size: 14px; cursor: pointer;
  color: var(--text-2); border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.tab-content { padding: 24px; max-width: 1100px; margin: 0 auto; width: 100%; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Buttons */
button { font-family: inherit; cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; border: none; padding: 8px 14px; border-radius: 6px; font-size: 13px; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border); padding: 8px 14px; border-radius: 6px; font-size: 13px; color: var(--text); }
.btn-link { background: none; border: none; color: var(--accent); font-size: 12.5px; padding: 2px 4px; }
.btn-danger { color: var(--red); }
.file-input-label { display: inline-flex; align-items: center; }

/* Panels */
.panel-header { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; flex-wrap: wrap; }
.panel-header h2 { margin: 0; font-size: 1.2rem; }
.panel-header h3 { margin: 0; font-size: 1rem; }
select, input, textarea { border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-size: 13px; }
textarea { font-family: "SF Mono", Consolas, monospace; width: 100%; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: 13px; margin-bottom: 10px; }
.data-table th { background: var(--surface-2); text-align: left; padding: 8px 12px; font-size: 11px; text-transform: uppercase; color: var(--text-2); }
.data-table td { padding: 8px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.preview-cell { font-family: "SF Mono", Consolas, monospace; font-size: 11.5px; color: var(--text-2); }

.pagination { display: flex; align-items: center; gap: 12px; font-size: 13px; margin-bottom: 24px; }
.pagination button { background: var(--surface); border: 1px solid var(--border); padding: 6px 10px; border-radius: 6px; }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* Forms */
.inline-form { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; max-width: 480px; }
.inline-form h3 { margin: 0 0 4px; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 6px !important; }
.form-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Badges */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }

/* Status */
.status-msg { padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.status-ok { background: var(--green-dim); color: var(--green); }
.status-error { background: var(--red-dim); color: var(--red); }

/* Overview cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.card-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.card-value { font-size: 1.1rem; font-weight: 700; }
.card-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.ddl-block { background: #0e1c2e; color: #b8d0e8; padding: 16px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; margin-bottom: 16px; }

@media (max-width: 700px) {
  .tab-content { padding: 12px; }
  .panel-header { flex-direction: column; align-items: stretch; }
}
