:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dfe5ef;
  --text: #061638;
  --muted: #6f7a96;
  --accent: #18b8aa;
  --accent-strong: #087f78;
  --accent-soft: #c9f6ed;
  --nav: #1c2a50;
  --nav-2: #263760;
  --nav-muted: #aab7d6;
  --danger: #b83232;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

button, input, textarea {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  padding: 22px 18px;
  background: var(--nav);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 20;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
}

.brand-text strong, .brand-text span {
  display: block;
}

.brand-text span {
  color: var(--nav-muted);
  font-size: 13px;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: var(--nav-muted);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
}

nav a.active, nav a:hover {
  color: #fff;
  background: var(--nav-2);
}

.sidebar-footer {
  margin-top: auto;
}

#modeBadge {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(201, 246, 237, .14);
  color: var(--accent-soft);
  font-size: 13px;
}

.app-shell {
  margin-left: 264px;
  padding: 28px;
  display: grid;
  gap: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--nav-2);
}

h1, h2, h3, p {
  margin: 0;
}

h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 15px; margin-top: 18px; }
p { color: var(--muted); line-height: 1.48; }
h1, h2, h3, p, strong, span, td, th {
  overflow-wrap: anywhere;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logout-button {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #e9eef6;
  cursor: pointer;
}

.login-panel, .panel, .gallery, .notice, .metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(21, 34, 72, 0.06);
}

.login-panel {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.login-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button, .ghost-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.primary-button:hover { background: var(--accent-strong); }

.ghost-button {
  color: var(--text);
  background: #e9eef6;
}

.full { width: 100%; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
}

.metric strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
  align-items: start;
}

.panel, .gallery {
  padding: 22px;
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.step {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.file-drop {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 156px;
  border: 1px dashed #b8c4d8;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  text-align: center;
  margin-bottom: 14px;
  padding: 18px;
}

.file-drop input { display: none; }
.file-drop span { font-weight: 800; }
.file-drop small { color: var(--muted); }

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

textarea {
  resize: vertical;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 160px;
  color: var(--text);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.choice-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
}

.choice-card.selected {
  border-color: var(--accent);
  background: #effdfa;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice-card strong {
  display: block;
  margin-bottom: 6px;
}

.choice-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.38;
}

.notice {
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
}

.notice.error {
  border-left-color: var(--danger);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.card-result img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef3f8;
}

.card-result details {
  padding: 12px;
}

.card-result summary {
  cursor: pointer;
  font-weight: 700;
}

.card-result p {
  margin-top: 8px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

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

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .sidebar {
    right: 0;
    bottom: auto;
    width: 100%;
    min-height: 62px;
    padding: 10px 14px;
    flex-direction: row;
    align-items: center;
  }

  .sidebar nav, .sidebar-footer {
    display: none;
  }

  .sidebar.open {
    bottom: 0;
    min-height: 100vh;
    flex-direction: column;
    align-items: stretch;
    padding: 22px 18px;
  }

  .sidebar.open nav, .sidebar.open .sidebar-footer {
    display: grid;
  }

  .app-shell {
    margin-left: 0;
    padding: 82px 16px 22px;
    overflow-x: hidden;
  }

  .menu-button { display: grid; }
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }
  .topbar > div { min-width: 0; }
  .account {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
  h1 { font-size: 24px; }
  .login-panel { flex-direction: column; align-items: flex-start; }
  .status-grid, .workspace, .choice-grid, .gallery-grid { grid-template-columns: 1fr; }
}
