:root {
  --bg: #f5f8fb;
  --panel: #ffffff;
  --ink: #14182f;
  --muted: #667085;
  --line: #dde5ef;
  --line-strong: #cbd5e1;
  --primary: #07936f;
  --primary-strong: #008463;
  --primary-soft: #e8f7f2;
  --shadow: 0 20px 60px rgba(28, 43, 74, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(7, 147, 111, 0.12), transparent 36rem),
    linear-gradient(135deg, #f8fbff 0%, #f4f9f8 50%, #ffffff 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 28px 18px;
  background: rgba(243, 252, 249, 0.8);
  border-right: 1px solid rgba(209, 224, 232, 0.75);
  backdrop-filter: blur(18px);
}

.brand,
.profile-card {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
  padding: 4px 0 18px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 16px;
  object-fit: contain;
  object-position: center;
  background: transparent;
  box-shadow: 0 16px 30px rgba(15, 118, 110, 0.14);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(135deg, #08a57d, #047a61);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(7, 147, 111, 0.22);
}

.brand-mark svg,
.icon svg,
.template-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.brand-mark svg {
  fill: currentColor;
  stroke: transparent;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand p,
.topbar p,
.template-card small,
.history-panel p,
.profile-card small,
.step small {
  margin: 0;
  color: var(--muted);
}

.brand p {
  margin-top: 6px;
  font-size: 14px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.sidebar.admin-mode .nav-list,
.sidebar.admin-mode .profile-card {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 0 18px;
  color: #465167;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary-strong);
  background: rgba(7, 147, 111, 0.1);
}

.nav-item.locked {
  opacity: 0.55;
}

.nav-item.locked:hover {
  color: #465167;
  background: transparent;
}

.admin-side {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-side.hidden {
  display: none;
}

.admin-side-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: #fff;
  background: linear-gradient(135deg, #0aa67e, #2479c9);
  border-radius: var(--radius);
}

.admin-side small {
  color: var(--muted);
}

.admin-side-menu {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.admin-menu {
  min-height: 40px;
  padding: 0 12px;
  color: #344054;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.admin-menu.active {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: rgba(7, 147, 111, 0.32);
}

.admin-section {
  display: none !important;
}

.admin-section.active {
  display: grid !important;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(180deg, #0aa67e, #008463);
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
  box-shadow: 0 12px 25px rgba(7, 147, 111, 0.22);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.72;
}

.full {
  width: 100%;
}

.profile-card {
  gap: 12px;
  width: 100%;
  min-height: 78px;
  margin-top: auto;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 35px rgba(28, 43, 74, 0.1);
}

.profile-card img,
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.profile-card img {
  object-fit: cover;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: linear-gradient(135deg, #1c6c9f, #08a57d);
  font-size: 13px;
  font-weight: 800;
}

.profile-card span:nth-child(2) {
  display: grid;
  gap: 3px;
  text-align: left;
}

.profile-card .icon {
  margin-left: auto;
}

.workspace {
  min-width: 0;
  padding: 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 0 0 8px;
  font-size: 29px;
  line-height: 1.12;
}

.top-actions,
.document-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.notification-popover {
  position: absolute;
  top: 54px;
  right: 0;
  z-index: 10;
  display: grid;
  gap: 8px;
  width: 280px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.notification-popover p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.app-view {
  display: none !important;
}

.app-view.active {
  display: grid !important;
}

.home-panel,
.admin-panel {
  grid-template-columns: minmax(300px, 420px) minmax(320px, 1fr);
  gap: 20px;
  padding: 20px;
}

.login-card,
.admin-card,
.welcome-card {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.login-card h3,
.admin-card h3,
.welcome-card h3 {
  margin: 0;
  font-size: 19px;
}

.login-card p,
.admin-card p,
.welcome-card p,
.login-state {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.login-card label,
.admin-card label {
  display: grid;
  gap: 8px;
  color: #2e374d;
  font-size: 13px;
  font-weight: 700;
}

.welcome-card {
  background:
    linear-gradient(135deg, rgba(7, 147, 111, 0.12), rgba(36, 121, 201, 0.08)),
    #fff;
}

.feature-list {
  display: grid;
  gap: 10px;
}

.feature-list span {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.token-box {
  min-height: 48px;
  padding: 12px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px dashed rgba(7, 147, 111, 0.35);
  border-radius: var(--radius);
  font-weight: 800;
  word-break: break-word;
}

.access-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.usage-table {
  overflow: auto;
}

.admin-notice-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.admin-notice {
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-notice strong,
.admin-notice small {
  display: block;
}

.admin-notice small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.api-token-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid rgba(7, 147, 111, 0.24);
  border-radius: var(--radius);
}

.api-token-card strong {
  font-size: 32px;
  line-height: 1;
}

.api-token-card span {
  color: var(--muted);
  font-size: 13px;
}

.usage-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.usage-table th,
.usage-table td {
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
}

.usage-table th {
  background: #f8fafc;
}

.access-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.access-actions {
  display: flex;
  gap: 8px;
}

.access-row strong,
.access-row small {
  display: block;
}

.access-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.access-row code {
  color: var(--primary-strong);
  font-weight: 800;
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  color: #344054;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
}

.mini-button.danger {
  color: #b42318;
  border-color: #f5b7b1;
}

.icon-button,
.document-actions button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: #172033;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.icon-button {
  width: 44px;
}

.badge {
  position: absolute;
  top: -7px;
  right: -6px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  color: white;
  background: #ef4b4b;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(440px, 0.95fr) minmax(500px, 1.1fr);
  gap: 18px;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.builder-card,
.result-card {
  min-height: 690px;
  padding: 16px;
}

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.steps::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: var(--progress, 31%);
  height: 3px;
  background: var(--primary);
  transition: width 0.2s ease;
}

.step {
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 10px;
  row-gap: 3px;
  padding: 8px 4px;
  color: #354055;
  text-align: left;
  background: transparent;
  border: 0;
}

.step span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-weight: 800;
}

.step.active span {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 12px 25px rgba(7, 147, 111, 0.24);
}

.step.done span {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: rgba(7, 147, 111, 0.28);
}

.step strong {
  font-size: 13px;
}

.step small {
  font-size: 12px;
}

.builder-card h3,
.result-card h3,
.template-panel h3 {
  margin: 0 0 18px;
  font-size: 18px;
}

.builder-card h3:not(:first-of-type),
.step-panel h3:not(:first-of-type) {
  margin-top: 28px;
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.form-grid label {
  display: grid;
  grid-column: span 3;
  gap: 8px;
  color: #2e374d;
  font-size: 13px;
  font-weight: 600;
}

.form-grid label:nth-child(n + 3):nth-child(-n + 8) {
  grid-column: span 2;
}

.form-grid label:nth-child(9),
.form-grid label:nth-child(10) {
  grid-column: span 3;
}

.one-column label {
  grid-column: 1 / -1;
}

.compact-grid {
  margin-top: 16px;
}

.compact-grid label:nth-child(n) {
  grid-column: span 3;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  color: #172033;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

textarea {
  min-height: 76px;
  padding-top: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(7, 147, 111, 0.12);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.split-actions {
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  color: #344054;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-weight: 800;
}

.hidden {
  display: none;
}

[data-detail-field].hidden {
  display: none;
}

.generate-box,
.prompt-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.generate-box {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
}

.generate-box p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.generate-box .quota-text {
  color: var(--primary-strong);
  font-weight: 800;
}

.generate-box .ai-status,
.server-status {
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.server-status {
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.server-status.online,
.ai-status.online {
  color: var(--primary-strong);
}

.server-status.offline,
.ai-status.offline {
  color: #b42318;
}

.ai-orb {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #fff;
  background: linear-gradient(135deg, #0aa67e, #2479c9);
  border-radius: var(--radius);
  box-shadow: 0 14px 28px rgba(7, 147, 111, 0.18);
}

.prompt-card {
  padding: 16px;
}

.prompt-card label {
  display: grid;
  gap: 8px;
  color: #2e374d;
  font-size: 13px;
  font-weight: 600;
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 27px;
  padding: 0 10px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
}

.dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
}

.dot.pulse {
  animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.7);
    opacity: 0.45;
  }
}

.document-actions button {
  gap: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.file-badge {
  display: grid;
  place-items: center;
  width: 19px;
  height: 22px;
  color: white;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 900;
}

.file-badge.word {
  background: #2c6dca;
}

.file-badge.pdf {
  background: #ef3d32;
}

.document-preview {
  height: 625px;
  padding: 28px 40px;
  overflow: auto;
  color: #0e1221;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(209, 224, 232, 0.18);
}

.document-preview:focus {
  outline: 3px solid rgba(7, 147, 111, 0.14);
  border-color: var(--primary);
}

.document-preview .page-note {
  margin: 18px 0 0;
  padding: 10px 12px;
  color: #475467;
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  font-size: 12px;
}

.document-preview h1,
.document-preview h2 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  line-height: 1.45;
}

.document-preview h2 {
  margin-bottom: 28px;
}

.document-preview section {
  margin-top: 24px;
}

.document-preview h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.document-preview p,
.document-preview li,
.document-preview dt,
.document-preview dd {
  font-size: 13px;
  line-height: 1.6;
}

.document-preview dl {
  display: grid;
  gap: 2px;
  margin: 0;
}

.document-preview dl div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
}

.document-preview dt::after {
  content: " :";
  float: right;
}

.document-preview dd {
  margin: 0;
}

.document-preview ol {
  margin: 4px 0 0 18px;
  padding-left: 12px;
}

.document-preview table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}

.document-preview th,
.document-preview td {
  padding: 8px;
  text-align: left;
  vertical-align: top;
  border: 1px solid #cbd5e1;
}

.document-preview th {
  background: #f1f5f9;
  font-weight: 800;
}

.template-panel {
  margin-top: 18px;
  padding: 16px;
}

.history-panel {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
  padding: 16px;
}

.history-panel h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.history-list {
  display: flex;
  gap: 10px;
  min-height: 44px;
  overflow-x: auto;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  min-width: 220px;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-item strong {
  grid-column: 1;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item small {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
}

.history-delete {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.history-empty {
  display: grid;
  place-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 18px;
}

.template-card {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 124px;
  padding: 12px;
  color: var(--ink);
  text-align: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.template-card:hover,
.template-card.active,
.document-actions button:hover,
.icon-button:hover {
  border-color: #b8c7d8;
  transform: translateY(-1px);
}

.template-card.active {
  border-color: rgba(7, 147, 111, 0.45);
  box-shadow: 0 0 0 3px rgba(7, 147, 111, 0.12);
}

.template-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
}

.template-icon.purple { color: #8d65e9; }
.template-icon.blue { color: #3987e8; }
.template-icon.green { color: #19af62; }
.template-icon.orange { color: #ff9f1c; }
.template-icon.red { color: #ff4949; }
.template-icon.teal { color: #00a99d; }
.template-icon.dark { color: #111827; }

.template-card strong {
  font-size: 14px;
}

.template-card small {
  font-size: 12px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 320px;
  padding: 13px 16px;
  color: white;
  background: #172033;
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(20, 24, 47, 0.22);
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .sidebar {
    align-items: center;
    padding-inline: 14px;
  }

  .brand div:last-child,
  .nav-item:not(.active),
  .nav-item.active,
  .profile-card span:nth-child(2),
  .profile-card .icon {
    font-size: 0;
  }

  .brand {
    padding-bottom: 8px;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    object-position: center;
  }

  .nav-item {
    justify-content: center;
    width: 56px;
    padding: 0;
  }

  .profile-card {
    justify-content: center;
    width: 60px;
    min-height: 60px;
    padding: 8px;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .home-panel,
  .admin-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: auto;
    flex-direction: row;
    justify-content: space-between;
    padding: 12px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: contain;
    object-position: center;
  }

  .nav-list,
  .profile-card {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 25px;
  }

  .form-grid,
  .steps,
  .template-grid,
  .home-panel,
  .admin-panel {
    grid-template-columns: 1fr;
  }

  .form-grid label,
  .form-grid label:nth-child(n) {
    grid-column: 1 / -1;
  }

  .result-header {
    flex-direction: column;
  }

  .document-actions {
    flex-wrap: wrap;
  }

  .history-panel {
    grid-template-columns: 1fr;
  }

  .document-preview {
    height: 540px;
    padding: 22px;
  }

  .document-preview dl div {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 4px;
  }

  .document-preview dt::after {
    content: "";
    float: none;
  }
}

@media print {
  @page {
    margin: 2cm;
  }

  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .builder-card,
  .history-panel,
  .result-header,
  .toast {
    display: none;
  }

  .app-shell,
  .main-grid {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .result-card {
    min-height: auto;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .document-preview {
    height: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    box-shadow: none;
  }

  .document-preview dl div {
    display: grid;
    grid-template-columns: 150px 12px 1fr;
    gap: 0;
  }

  .document-preview dt::after {
    content: "";
  }

  .document-preview dt {
    grid-column: 1;
  }

  .document-preview dd {
    grid-column: 3;
  }

  .document-preview dl div::after {
    content: ":";
    grid-column: 2;
    grid-row: 1;
    text-align: center;
  }
}

body.dark {
  --bg: #0f172a;
  --panel: #111827;
  --ink: #eef2ff;
  --muted: #aab4c7;
  --line: #273449;
  --line-strong: #3a4a62;
  --primary-soft: rgba(7, 147, 111, 0.16);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  background:
    radial-gradient(circle at 0 0, rgba(7, 147, 111, 0.18), transparent 36rem),
    linear-gradient(135deg, #0b1120 0%, #111827 55%, #0f172a 100%);
}

body.dark .sidebar {
  background: rgba(15, 23, 42, 0.9);
  border-right-color: #273449;
}

body.dark .panel,
body.dark .login-card,
body.dark .admin-card,
body.dark .welcome-card,
body.dark .template-card,
body.dark .history-item,
body.dark .profile-card,
body.dark .document-actions button,
body.dark .icon-button,
body.dark .generate-box,
body.dark .prompt-card,
body.dark .notification-popover {
  color: var(--ink);
  background: rgba(17, 24, 39, 0.95);
  border-color: var(--line);
}

body.dark input,
body.dark select,
body.dark textarea,
body.dark .document-preview {
  color: var(--ink);
  background: #0b1220;
  border-color: var(--line-strong);
}

body.dark .document-preview th,
body.dark .document-preview .page-note {
  background: #172033;
}

body.dark .secondary {
  color: var(--ink);
  background: #111827;
  border-color: var(--line-strong);
}

body.dark .access-row,
body.dark .admin-notice,
body.dark .mini-button,
body.dark .feature-list span,
body.dark .admin-side,
body.dark .admin-menu,
body.dark .server-status {
  color: var(--ink);
  background: #0b1220;
  border-color: var(--line);
}

body.dark .admin-menu.active {
  color: #33d6a6;
  background: rgba(7, 147, 111, 0.18);
}

body.dark .usage-table th {
  background: #172033;
}
