/* ==========================================================================
   kie2api control plane — portable light SaaS design system.
   Single blue accent; red/green reserved for semantic state.
   ========================================================================== */

:root {
  --ink:       #101827;
  --muted:     #718096;
  --line:      #e5e9ef;
  --blue:      #4056e8;
  --blue-dark: #3046d2;
  --soft:      #f5f7fb;
  --green:     #20a16a;
  --red:       #d84c61;
  --shadow:    0 18px 50px rgba(18, 32, 61, .08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--soft);
  color: var(--ink);
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, a, input, select, textarea {
  transition: color .2s ease, background-color .2s ease,
              border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

button { font-family: inherit; cursor: pointer; }

/* --- Eyebrow / typography ------------------------------------------------- */

.eyebrow {
  font: 500 10px "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
  color: var(--blue);
  text-transform: uppercase;
  margin: 0 0 12px;
}

.meta, .docs, .technical-label {
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

h1, h2, h3 { margin: 0; }

/* ==========================================================================
   Login page
   ========================================================================== */

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.06fr .94fr;
  gap: 80px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 60px 34px;
  align-items: center;
}

.login-visual { padding: 20px 0; }

.brand-mark, .brand-symbol {
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  border-radius: 15px;
  transform: rotate(-8deg);
  box-shadow: 0 8px 20px rgba(64, 86, 232, .25);
}

.brand-mark {
  width: 49px;
  height: 49px;
  font-size: 22px;
  margin-bottom: 44px;
}

.visual-kicker {
  font: 500 10px "DM Mono", ui-monospace, monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 22px;
}

.login-visual h1 {
  font-size: clamp(40px, 5vw, 66px);
  line-height: 1.08;
  letter-spacing: -.06em;
  font-weight: 800;
  margin-bottom: 26px;
}

.login-visual h1 .accent { color: var(--blue); }

.visual-copy {
  max-width: 410px;
  color: var(--muted);
  line-height: 1.8;
  margin: 0 0 38px;
}

.visual-line {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #a0aaba;
}

.visual-line .rule {
  flex: 0 0 54px;
  height: 2px;
  background: var(--blue);
}

.visual-line span {
  font: 400 10px "DM Mono", ui-monospace, monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.login-card {
  width: 100%;
  max-width: 450px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 46px 48px;
  justify-self: end;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  margin-bottom: 38px;
}

.login-brand .brand-symbol {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  font-size: 14px;
}

.login-brand .brand-muted { color: #a5afbd; font-weight: 500; }

.login-heading h2 {
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -.05em;
  margin-bottom: 10px;
}

/* Scoped to the descriptive paragraph so it cannot override the eyebrow,
   which must stay blue per the design system. */
.login-heading > p:not(.eyebrow) {
  color: var(--muted);
  margin: 0 0 30px;
}

label {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #dce2ea;
  background: #fbfcfe;
  border-radius: 9px;
  padding: 12px 13px;
  outline: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

input[type="password"] { letter-spacing: .02em; }

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(64, 86, 232, .1);
}

#admin-password { height: 48px; margin-bottom: 18px; }

.primary {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.primary:hover { background: var(--blue-dark); transform: translateY(-1px); }

.primary.full { width: 100%; }

.primary[disabled], .secondary-button[disabled], .ghost-button[disabled] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.ghost-button, .secondary-button {
  background: transparent;
  color: #667286;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ghost-button:hover, .secondary-button:hover {
  background: #e9edf5;
  color: var(--ink);
}

.secondary-button {
  border: 1px solid #dce2ea;
  background: #fff;
}

.danger-button {
  background: #fff;
  color: var(--red);
  border: 1px solid #f2d3d8;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
}

.danger-button:hover { background: #fdf2f4; border-color: var(--red); }

.error {
  min-height: 1.4em;
  color: var(--red);
  font-size: 13px;
  margin: 12px 0 0;
}

.error.inline { min-height: 1.4em; margin: 0 0 10px; }

.login-foot {
  margin-top: 22px;
  color: #a0aaba;
  font-size: 12px;
  line-height: 1.7;
}

/* ==========================================================================
   Dashboard shell
   ========================================================================== */

main.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 34px 56px;
}

.topbar {
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.topbar-brand { display: flex; align-items: center; gap: 13px; }

.topbar-brand .brand-symbol {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 15px;
}

.topbar-brand .name { font-weight: 800; font-size: 15px; letter-spacing: -.02em; }

.topbar-brand .sub {
  font: 400 10px "DM Mono", ui-monospace, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8994a4;
}

.topbar-actions { display: flex; align-items: center; gap: 16px; }

.online-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6c7787;
  font: 400 11px "DM Mono", ui-monospace, monospace;
  letter-spacing: .06em;
}

.online-dot i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px #20a16a1f;
}

.online-dot.is-down i { background: var(--red); box-shadow: 0 0 0 3px #d84c611f; }

.tabs {
  height: 80px;
  display: flex;
  align-items: stretch;
  gap: 30px;
  border-bottom: 1px solid var(--line);
}

.tab {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0 2px;
  color: #919baa;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab:hover { color: var(--ink); }

.tab[aria-selected="true"] {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab .icon { font-size: 16px; line-height: 1; }

.panel { padding-top: 43px; }
.panel[hidden] { display: none; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 28px;
}

.section-heading h2 {
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -.06em;
}

.section-subtitle { color: var(--muted); margin: 8px 0 0; }

.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; white-space: nowrap; }

.notice {
  display: flex;
  gap: 13px;
  background: #eff2ff;
  border: 1px solid #e0e4ff;
  border-radius: 12px;
  padding: 15px 18px;
  color: #64719f;
  margin-bottom: 22px;
  font-size: 13px;
  line-height: 1.7;
}

.notice strong { color: #4c5cc6; }
.notice p { margin: 0; }
.notice-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4056e81a;
  color: var(--blue);
  display: grid;
  place-items: center;
  font: 500 11px "DM Mono", monospace;
  margin-top: 2px;
}

.list { display: flex; flex-direction: column; gap: 12px; }

.row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 20px 22px;
  box-shadow: 0 3px 10px rgba(18, 32, 61, .02);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.row:hover { border-color: #cbd3e2; box-shadow: var(--shadow); }

.row-main { min-width: 0; flex: 1; }

.row strong { display: block; font-size: 14px; }

.row .meta {
  color: #8994a4;
  font: 11px/1.8 "DM Mono", ui-monospace, monospace;
  word-break: break-word;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  white-space: nowrap;
}

.ok { color: var(--green); font-weight: 600; }
.bad { color: var(--red); font-weight: 600; }
.dim { color: #8994a4; }

.empty, .loading, .load-error {
  padding: 30px 22px;
  text-align: center;
  color: #8994a4;
  border: 1px dashed #dce2ea;
  border-radius: 13px;
  background: #fff;
}

.load-error { color: var(--red); border-style: solid; }

.docs {
  background: #111a2c;
  color: #dce7ff;
  font: 12px/1.8 "DM Mono", ui-monospace, monospace;
  padding: 24px;
  border-radius: 14px;
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
}

.key-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #111a2c;
  color: #dce7ff;
  border-radius: 14px;
  padding: 16px 18px;
  font: 12px "DM Mono", ui-monospace, monospace;
  margin-bottom: 18px;
  overflow-x: auto;
}

/* ==========================================================================
   Dialog
   ========================================================================== */

dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(680px, calc(100% - 30px));
  box-shadow: 0 25px 80px rgba(16, 24, 39, .22);
}

dialog::backdrop {
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 32px 32px 0;
}

.dialog-header h3 { font-size: 21px; letter-spacing: -.04em; }

.dialog-close {
  background: transparent;
  border: 0;
  font-size: 20px;
  line-height: 1;
  color: #8994a4;
  border-radius: 8px;
  width: 32px;
  height: 32px;
}

.dialog-close:hover { background: #e9edf5; color: var(--ink); }

.dialog-note { padding: 12px 32px 0; color: var(--muted); font-size: 13px; margin: 0; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 15px;
  padding: 24px 32px 0;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.dialog-body-text { padding: 0 32px; color: var(--muted); }

.dialog-error {
  padding: 0 32px;
  min-height: 1.4em;
  color: var(--red);
  font-size: 13px;
  margin-top: 14px;
}

dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 32px 32px;
  margin: 0;
}

.tz-hint { color: #8994a4; font-size: 12px; margin-top: 10px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Responsive: single 780px breakpoint
   ========================================================================== */

@media (max-width: 780px) {
  main.shell { padding: 0 18px 40px; }

  .login-shell {
    grid-template-columns: 1fr;
    padding: 34px 18px;
    gap: 30px;
  }

  .login-visual .visual-line { display: none; }
  .brand-mark { margin-bottom: 26px; }
  .login-card { padding: 32px 24px; justify-self: stretch; max-width: none; }
  .visual-copy { margin-bottom: 22px; }

  .topbar { height: 90px; }
  .topbar-actions .online-dot { display: none; }

  .tabs { height: 68px; gap: 22px; overflow-x: auto; }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .heading-actions { width: 100%; }
  .heading-actions > button { flex: 1 1 auto; justify-content: center; }

  .row { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-start; }
  .actions > button { flex: 1 1 auto; justify-content: center; }

  .form-grid { grid-template-columns: 1fr; padding: 20px 20px 0; }
  .form-grid .span-2 { grid-column: auto; }
  .dialog-header { padding: 24px 20px 0; }
  .dialog-note { padding: 10px 20px 0; }
  .dialog-error { padding: 0 20px; }
  .dialog-body-text { padding: 0 20px; }
  dialog menu { padding: 12px 20px 24px; }
  dialog menu > button { flex: 1 1 auto; justify-content: center; }
}
