/* ==========================================================================
   agentik2api control plane
   Visual reference: ui-design-guide.md (portable light SaaS system).
   One blue accent; red/green reserved for status semantics only.
   ========================================================================== */

: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);
}

*,
*::before,
*::after {
  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;
}

/* ------------------------------- 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 10px;
}

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

h2 {
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -.06em;
  font-weight: 800;
  margin: 0 0 8px;
}

h3 {
  font-size: 17px;
  letter-spacing: -.02em;
  font-weight: 700;
  margin: 0 0 6px;
}

p {
  margin: 0;
}

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

.meta {
  color: #8994a4;
  font-size: 11px;
  line-height: 1.8;
}

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

.muted {
  color: var(--muted);
}

.ok {
  color: var(--green);
  font-weight: 700;
}

.bad {
  color: var(--red);
  font-weight: 700;
}

.warn {
  color: #b7791f;
  font-weight: 700;
}

/* --------------------------------- buttons ------------------------------- */

.primary {
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
  border-radius: 9px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
}

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

.primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid #dce2ea;
  background: #fff;
  color: #667286;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
}

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

.secondary-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.ghost-button {
  background: transparent;
  border: 1px solid transparent;
  color: #667286;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 600;
}

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

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

.danger-button:hover:not(:disabled) {
  background: #fdf2f4;
}

.danger-button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 14px;
  margin-right: 6px;
}

/* ----------------------------------- login -------------------------------- */

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

.login-visual .brand-mark {
  margin-bottom: 44px;
}

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

.brand-mark.small,
.brand-symbol.small {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 17px;
}

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

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

.visual-line {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #a0aaba;
  font: 500 10px "DM Mono", ui-monospace, monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.visual-line::before {
  content: "";
  width: 44px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

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

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.02em;
  margin-bottom: 40px;
}

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

.login-heading {
  margin-bottom: 26px;
}

.login-heading h2 {
  font-size: 26px;
}

/* Scope the gray subtitle to non-eyebrow paragraphs so the eyebrow treatment
   (10px DM Mono, uppercase, blue, .16em tracking) is never overridden. */
.login-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 13px;
}

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

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  border: 1px solid #dce2ea;
  background: #fbfcfe;
  border-radius: 9px;
  padding: 12px 13px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

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

input:disabled,
select:disabled,
textarea:disabled {
  background: #f1f3f8;
  color: #8994a4;
  cursor: not-allowed;
}

.login-card input[type="password"] {
  height: 48px;
}

.form-field {
  margin-bottom: 16px;
}

.field-hint {
  color: #919baa;
  font-size: 11px;
  margin-top: 6px;
  line-height: 1.6;
}

.login-submit {
  width: 100%;
  margin-top: 10px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

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

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

/* -------------------------------- dashboard ------------------------------ */

.dashboard-main {
  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);
  gap: 20px;
}

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

.topbar-brand strong {
  display: block;
  font-size: 15px;
  letter-spacing: -.02em;
}

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

.online-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6c7787;
  font: 500 10px "DM Mono", ui-monospace, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.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.down i {
  background: var(--red);
  box-shadow: 0 0 0 3px #d84c611f;
}

/* ----------------------------------- tabs -------------------------------- */

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

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: 0;
  padding: 0 2px;
  color: #919baa;
  font-weight: 700;
  font-size: 14px;
}

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

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

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
}

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

.panel {
  padding-top: 43px;
}

.panel[hidden] {
  display: none;
}

/* ------------------------------ section header --------------------------- */

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

.section-heading h2 {
  margin-bottom: 6px;
}

.section-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---------------------------------- notice ------------------------------- */

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

.notice strong {
  color: #4c5cc6;
}

.notice-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font: 700 10px "DM Mono", monospace;
  margin-top: 2px;
}

.notice.warn-notice {
  background: #fff8ec;
  border-color: #f5e2c0;
  color: #8a6d3b;
}

.notice.warn-notice strong {
  color: #a06412;
}

.notice.warn-notice .notice-icon {
  background: #d99b26;
}

/* ----------------------------------- rows -------------------------------- */

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

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

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

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

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

.row .meta {
  overflow-wrap: anywhere;
}

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

.empty-state,
.loading-state,
.error-state {
  border: 1px dashed #dce2ea;
  border-radius: 13px;
  padding: 30px 22px;
  text-align: center;
  color: #919baa;
  font-size: 13px;
  background: #fff;
}

.error-state {
  color: var(--red);
  border-color: #f0ccd3;
  background: #fffafb;
}

/* -------------------------------- documents ------------------------------ */

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

.docs-actions {
  margin-bottom: 12px;
}

.docs code {
  font-family: inherit;
}

/* --------------------------------- 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);
  color: var(--ink);
}

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: 16px;
  padding: 32px 32px 0;
}

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

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

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

.dialog-note {
  padding: 6px 32px 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

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

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

dialog .error {
  padding: 0 32px;
  margin-top: 10px;
}

.dialog-menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 24px 32px 32px;
}

/* --------------------------------- scaling ------------------------------- */

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

.badge {
  display: inline-block;
  font: 500 10px "DM Mono", ui-monospace, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #dce2ea;
  color: #667286;
  background: #fbfcfe;
  vertical-align: middle;
  margin-left: 8px;
}

.badge.ok-badge {
  border-color: #bfe7d4;
  background: #f2fbf7;
  color: var(--green);
}

.badge.bad-badge {
  border-color: #f0ccd3;
  background: #fffafb;
  color: var(--red);
}

.badge.warn-badge {
  border-color: #f5e2c0;
  background: #fff8ec;
  color: #b7791f;
}

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 780px) {
  .login-shell {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 32px 18px;
    align-items: start;
  }

  .login-visual .brand-mark {
    margin-bottom: 26px;
  }

  .visual-line {
    display: none;
  }

  .login-card {
    max-width: 100%;
    justify-self: stretch;
    padding: 32px 24px;
  }

  .dashboard-main {
    padding: 0 18px 40px;
  }

  .topbar {
    height: 90px;
  }

  .topbar .online-dot {
    display: none;
  }

  .tabs {
    height: 68px;
    gap: 22px;
  }

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

  .heading-actions {
    justify-content: stretch;
  }

  .heading-actions > button {
    flex: 1 1 auto;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    justify-content: flex-start;
    white-space: normal;
  }

  .form-grid {
    grid-template-columns: 1fr;
    padding: 20px 22px 0;
  }

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

  .dialog-header,
  .dialog-note,
  dialog .error {
    padding-left: 22px;
    padding-right: 22px;
  }

  .dialog-menu {
    padding: 20px 22px 24px;
    flex-wrap: wrap;
  }

  .docs {
    padding: 18px;
  }
}
