:root {
  color-scheme: light;
  --paper: #f7f2ea;
  --paper-strong: #fffaf2;
  --ink: #1f252e;
  --muted: #66717f;
  --line: #ded6c8;
  --blue: #3467d6;
  --blue-soft: #e7eefc;
  --coral: #e46155;
  --green: #16845f;
  --gold: #b77a16;
  --shadow: 0 18px 50px rgba(45, 37, 25, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(52, 103, 214, 0.08), transparent 28%),
    linear-gradient(230deg, rgba(228, 97, 85, 0.08), transparent 32%),
    var(--paper);
}

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

button {
  cursor: pointer;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: var(--muted);
}

.mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

.auth-showcase {
  min-height: 100vh;
  padding: clamp(28px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(31, 37, 46, 0.82), rgba(31, 37, 46, 0.58)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='900' viewBox='0 0 1200 900'%3E%3Crect width='1200' height='900' fill='%23d8d1c4'/%3E%3Cg fill='none' stroke='%23252b33' stroke-width='2' opacity='.18'%3E%3Cpath d='M88 130h420v120H88zM650 92h380v220H650zM180 360h760v86H180zM90 568h310v170H90zM492 552h590v210H492z'/%3E%3Cpath d='M122 170h308M682 145h280M682 196h210M220 398h640M126 620h230M538 604h490M538 656h420M538 708h300'/%3E%3C/g%3E%3Cg fill='%23e46155' opacity='.48'%3E%3Crect x='88' y='282' width='120' height='14'/%3E%3Crect x='650' y='344' width='170' height='14'/%3E%3C/g%3E%3Cg fill='%233467d6' opacity='.42'%3E%3Crect x='226' y='282' width='210' height='14'/%3E%3Crect x='842' y='344' width='150' height='14'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  color: #fff;
}

.auth-showcase h1 {
  max-width: 760px;
  margin: 40px 0 18px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.92;
  letter-spacing: 0;
}

.auth-showcase p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
  line-height: 1.7;
}

.auth-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-meta span {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 9px 13px;
  color: rgba(255, 255, 255, 0.82);
}

.auth-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(255, 250, 242, 0.84);
  backdrop-filter: blur(14px);
}

.auth-card {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: var(--shadow);
}

.auth-tabs,
.mode-tabs,
.lang-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #efe7da;
}

.auth-tabs button,
.mode-tabs button,
.lang-toggle button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.auth-tabs button.active,
.mode-tabs button.active,
.lang-toggle button.active {
  color: var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 8px 24px rgba(45, 37, 25, 0.1);
}

.lang-toggle {
  margin-bottom: 16px;
}

.sidebar .lang-toggle {
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 7px;
  margin: 15px 0;
}

.field label {
  color: #3d4652;
  font-size: 13px;
  font-weight: 750;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fffdf8;
  outline: none;
}

.field textarea {
  min-height: 280px;
  resize: vertical;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(52, 103, 214, 0.12);
}

.primary,
.secondary,
.ghost,
.icon-btn,
.danger {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 760;
}

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

.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper-strong);
}

.ghost {
  color: var(--muted);
  background: transparent;
}

.danger {
  color: #fff;
  background: var(--coral);
}

.icon-btn {
  width: 40px;
  padding: 0;
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper-strong);
}

.full {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(360px, 1fr) minmax(420px, 0.92fr);
}

.sidebar,
.list-pane,
.editor-pane {
  min-height: 100vh;
}

.sidebar {
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.68);
}

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

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span,
.user-card span,
.small {
  color: var(--muted);
  font-size: 13px;
}

.user-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.section-label {
  margin: 28px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.category-list,
.prompt-list {
  display: grid;
  gap: 8px;
}

.category-row,
.prompt-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.74);
}

.category-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.category-main {
  min-width: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  color: var(--ink);
  padding: 6px;
}

.category-main.active {
  font-weight: 850;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--blue);
}

.count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 4px;
}

.row-actions button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.list-pane {
  padding: 24px;
  border-right: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 16px;
}

.search {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fffdf8;
  outline: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.72);
}

.stat strong {
  display: block;
  font-size: 22px;
}

.prompt-card {
  width: 100%;
  padding: 15px;
  text-align: left;
  color: var(--ink);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.prompt-card:hover,
.prompt-card.active {
  transform: translateY(-1px);
  border-color: rgba(52, 103, 214, 0.5);
  box-shadow: 0 12px 26px rgba(45, 37, 25, 0.1);
}

.prompt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prompt-head h3 {
  margin: 0;
  font-size: 17px;
}

.prompt-card p {
  margin: 8px 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag,
.pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 760;
}

.tag {
  color: #28415d;
  background: var(--blue-soft);
}

.pill {
  color: var(--green);
  background: rgba(32, 166, 122, 0.12);
}

.editor-pane {
  padding: 24px;
  background: rgba(255, 250, 242, 0.5);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.editor-header h2 {
  margin: 0;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

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

.empty {
  min-height: 420px;
  border: 1px dashed #cbbfab;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.empty h3 {
  margin: 0 0 8px;
  color: var(--ink);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 37, 46, 0.38);
}

.modal {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.modal h3 {
  margin: 0 0 14px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 34px);
  gap: 8px;
}

.swatch {
  width: 34px;
  height: 34px;
  border: 2px solid transparent;
  border-radius: 50%;
}

.swatch.active {
  border-color: var(--ink);
}

.hidden {
  display: none !important;
}

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

  .editor-pane {
    grid-column: 1 / -1;
    min-height: auto;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .auth-page,
  .app-shell,
  .form-grid,
  .stats,
  .search-row {
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    min-height: 52vh;
  }

  .auth-panel,
  .sidebar,
  .list-pane,
  .editor-pane {
    min-height: auto;
  }

  .sidebar,
  .list-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar,
  .editor-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .editor-actions button,
  .topbar button {
    width: 100%;
  }
}
