:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #64717d;
  --line: #d9e2e7;
  --surface: #ffffff;
  --panel: #f6f9fb;
  --deep: #12343b;
  --accent: #0e7c7b;
  --accent-strong: #0a5f66;
  --warm: #f59e0b;
  --danger: #b42318;
  --success: #0f7a55;
  --shadow: 0 16px 38px rgba(17, 34, 51, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--panel);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 66px;
  padding: 12px clamp(18px, 4vw, 42px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.brand {
  color: var(--deep);
  font-weight: 800;
}

.brand-mark {
  align-items: center;
  background: var(--deep);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 54px;
  justify-content: center;
  letter-spacing: 0;
  width: 54px;
}

.brand-mark.small {
  height: 34px;
  width: 34px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-shell {
  margin: 0 auto;
  max-width: 1320px;
  padding: 24px clamp(16px, 4vw, 42px) 42px;
}

.workspace-head {
  align-items: flex-end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.workspace-head h1 {
  font-size: clamp(1.7rem, 2.8vw, 2.8rem);
  line-height: 1.05;
  margin: 6px 0 0;
}

.breadcrumbs {
  color: var(--muted);
  display: flex;
  font-size: 0.88rem;
  gap: 7px;
}

.metric-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric-strip > div,
.tool-form,
.file-surface,
.backup-panel,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-strip > div {
  min-height: 88px;
  padding: 18px;
}

.label,
.muted,
.section-head span,
.plain-list span {
  color: var(--muted);
}

.label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.metric-strip strong {
  color: var(--deep);
  font-size: 1.35rem;
}

.tool-grid,
.content-grid {
  display: grid;
  gap: 18px;
}

.tool-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.tool-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.spaced-top {
  margin-top: 18px;
}

.content-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.tool-form,
.file-surface,
.backup-panel {
  padding: 18px;
}

.handoff-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  line-height: 1.55;
  padding: 22px;
}

.handoff-surface h2 {
  color: var(--deep);
  font-size: 1.05rem;
  margin: 18px 0 8px;
}

.handoff-surface h2:first-child {
  margin-top: 0;
}

.handoff-surface pre {
  background: #102a32;
  border-radius: 8px;
  color: #f4fbfb;
  overflow-x: auto;
  padding: 14px;
}

.tool-form h2,
.section-head h2,
.backup-panel h2 {
  font-size: 1rem;
  margin: 0;
}

.tool-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  color: var(--deep);
  display: grid;
  font-size: 0.84rem;
  font-weight: 800;
  gap: 6px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #c9d5dc;
  border-radius: 7px;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 124, 123, 0.16);
  outline: none;
}

.check-line {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.check-line input {
  min-height: auto;
  width: auto;
}

.primary-button,
.secondary-button,
.ghost-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: #eaf5f4;
  border-color: #b8d9d6;
  color: var(--accent-strong);
}

.secondary-button:hover {
  background: #dcefed;
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--deep);
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.message-strip {
  margin: 14px auto 0;
  max-width: 1320px;
  padding: 0 clamp(16px, 4vw, 42px);
}

.notice {
  background: #eaf8f1;
  border: 1px solid #b7e2cb;
  border-radius: 8px;
  color: var(--success);
  margin: 0 0 10px;
  padding: 11px 12px;
}

.notice.error {
  background: #fff0ee;
  border-color: #f5c4bd;
  color: var(--danger);
}

.section-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

.file-table {
  border-collapse: collapse;
  min-width: 680px;
  width: 100%;
}

.file-table th,
.file-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.file-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.plain-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.plain-list li {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
  padding: 0 0 10px;
}

.plain-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.mini-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.login-body {
  align-items: center;
  background:
    linear-gradient(120deg, rgba(18, 52, 59, 0.93), rgba(14, 124, 123, 0.74)),
    #12343b;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-shell {
  width: min(100%, 430px);
}

.login-panel {
  padding: 32px;
}

.login-panel h1 {
  margin: 16px 0 4px;
}

.stack-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

@media (max-width: 980px) {
  .metric-strip,
  .tool-grid,
  .tool-grid.two,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .workspace-head,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding-top: 16px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .ghost-button {
    width: 100%;
  }

  .top-actions form {
    width: 100%;
  }
}

.help-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.help-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.help-nav a {
  background: #eef6f6;
  border: 1px solid #c8dddd;
  border-radius: 7px;
  color: var(--accent-strong);
  font-weight: 800;
  padding: 8px 10px;
}

.help-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.help-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.help-card h2 {
  color: var(--deep);
  font-size: 1rem;
  margin: 0 0 10px;
}

.help-card ol,
.help-card ul {
  color: var(--ink);
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.help-callout {
  background: #f7fbfb;
  border-left: 4px solid var(--accent);
  margin-top: 16px;
  padding: 14px 16px;
}

@media (max-width: 780px) {
  .help-grid {
    grid-template-columns: 1fr;
  }

  .help-nav a {
    flex: 1 1 150px;
    text-align: center;
  }
}

/* AIBiz topbar contrast guard: keeps header actions readable through theme/color updates. */
:root {
  --aibiz-topbar-button-bg: var(--surface, var(--panel, #ffffff));
  --aibiz-topbar-button-text: var(--deep, var(--ink, #17202a));
  --aibiz-topbar-button-hover-bg: color-mix(in srgb, var(--accent, var(--primary, #0e7c7b)) 12%, var(--surface, #ffffff));
  --aibiz-topbar-button-hover-text: var(--accent-strong, var(--primary-dark, var(--primary, #0a5f66)));
  --aibiz-topbar-button-border: var(--line, #d9e2e7);
}

.topbar .ghost-button {
  background: var(--aibiz-topbar-button-bg);
  border-color: var(--aibiz-topbar-button-border);
  color: var(--aibiz-topbar-button-text);
  text-decoration: none;
  text-shadow: none;
  transition: border-color 120ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.topbar .ghost-button:hover,
.topbar .ghost-button:focus-visible {
  background: var(--aibiz-topbar-button-hover-bg);
  border-color: var(--accent, var(--primary, #0e7c7b));
  color: var(--aibiz-topbar-button-hover-text);
  text-decoration: none;
}

.topbar .ghost-button:visited {
  color: var(--aibiz-topbar-button-text);
}

.topbar .ghost-button:hover:visited {
  color: var(--aibiz-topbar-button-hover-text);
}

