:root {
  color-scheme: light;
  --ink: #18221e;
  --muted: #68736d;
  --line: #d9ddd3;
  --paper: #f4f1e8;
  --panel: #fffdf7;
  --panel-strong: #ece5d4;
  --accent: #185b4b;
  --accent-dark: #0f332d;
  --accent-2: #c24b32;
  --accent-3: #e1a63a;
  --soft: #e8eee4;
  --shadow: 0 18px 45px rgba(35, 42, 33, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  background:
    linear-gradient(90deg, rgba(24, 91, 75, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(24, 91, 75, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 38px 38px;
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 8%, rgba(194, 75, 50, 0.12), transparent 22%),
    radial-gradient(circle at 88% 18%, rgba(225, 166, 58, 0.14), transparent 24%);
  mix-blend-mode: multiply;
}

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

button {
  border: 0;
  background: var(--accent);
  color: white;
  padding: 11px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 8px 18px rgba(24, 91, 75, 0.22);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.78;
  transform: none;
}

button.is-loading {
  position: relative;
  padding-left: 39px;
}

button.is-loading::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: white;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 13px;
  background: #fffefb;
  color: var(--ink);
  outline: none;
  transition:
    border 160ms ease,
    box-shadow 160ms ease;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(24, 91, 75, 0.13);
}

::placeholder {
  color: #9b9384;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(24, 91, 75, 0.18);
  background: #ebe2cf;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--accent-2);
  color: white;
  border: 2px solid var(--ink);
  border-radius: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 5px 5px 0 var(--ink);
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border: 1px solid transparent;
  box-shadow: none;
}

nav button span {
  width: 30px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(24, 91, 75, 0.1);
  color: var(--accent);
  font-size: 12px;
}

nav button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

nav button.active span {
  background: var(--accent-3);
  color: var(--ink);
}

.side-note {
  margin-top: auto;
  padding: 14px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid rgba(24, 91, 75, 0.18);
  border-radius: 8px;
}

.side-note strong {
  font-family: Georgia, "Times New Roman", serif;
}

.side-note p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.workspace {
  position: relative;
  padding: 30px;
}

.topbar {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(24, 91, 75, 0.16);
}

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

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 30px;
}

h3 {
  margin-bottom: 0;
  font-size: 21px;
}

.topbar p,
.section-head p {
  color: var(--muted);
  line-height: 1.5;
}

.login {
  display: grid;
  grid-template-columns: 230px 170px auto;
  gap: 9px;
  min-width: 560px;
  align-items: end;
  padding: 12px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login label span,
.field > span {
  display: block;
  margin-bottom: 7px;
  font-weight: 900;
  color: var(--accent-dark);
}

.view {
  display: none;
  animation: rise 260ms ease both;
}

.view.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.section-head p {
  max-width: 520px;
  margin-bottom: 4px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 7px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel,
.metrics,
.list,
.guide-card {
  background: var(--panel);
  border: 1px solid rgba(24, 91, 75, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.compact {
  display: grid;
  gap: 13px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.stamp,
.card-tag {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-3);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.stamp.alt {
  background: var(--accent-2);
  color: white;
}

.field {
  display: block;
}

.field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.file-field input {
  border-style: dashed;
  background: #fbf6e8;
}

.row,
.two-col,
.work-grid {
  display: grid;
  gap: 16px;
}

.row {
  grid-template-columns: minmax(0, 1fr) 220px;
}

.two-col {
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
  align-items: start;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
  padding: 14px;
}

.command-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 4px;
  padding: 12px;
  border: 1px solid rgba(24, 91, 75, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.76);
  box-shadow: 0 10px 28px rgba(35, 42, 33, 0.08);
}

.command-strip button {
  background: var(--ink);
}

.metric {
  min-height: 116px;
  border: 1px solid rgba(24, 91, 75, 0.16);
  background: linear-gradient(135deg, var(--soft), #fff9ec);
  padding: 15px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 6px;
  background: var(--accent-2);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
}

.work-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.guide-card {
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.guide-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3), var(--accent));
}

.guide-card:hover {
  transform: translateY(-2px);
  transition: transform 180ms ease;
}

.guide-card h3 {
  margin-top: 14px;
}

.guide-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.list {
  margin-top: 18px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.operation-status {
  min-height: 0;
  margin-top: 14px;
}

.operation-status:not(:empty) {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(24, 91, 75, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.8);
  box-shadow: 0 10px 28px rgba(35, 42, 33, 0.08);
}

.operation-status strong {
  display: block;
  color: var(--ink);
}

.operation-status p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.status-dot {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
}

.operation-status.loading .status-dot {
  background: transparent;
  border: 2px solid rgba(24, 91, 75, 0.22);
  border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}

.operation-status.success {
  border-color: rgba(24, 91, 75, 0.38);
  background: #eef7ed;
}

.operation-status.success .status-dot {
  background: var(--accent);
}

.operation-status.error {
  border-color: rgba(194, 75, 50, 0.42);
  background: #fff1ec;
}

.operation-status.error .status-dot {
  background: var(--accent-2);
}

.item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px;
  background: #fffaf0;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 14px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.68);
}

.item strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
}

.item small {
  display: inline-block;
  margin: 6px 0;
  color: var(--accent);
  word-break: break-all;
}

.document-item {
  display: grid;
  gap: 6px;
}

.document-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(24, 91, 75, 0.1);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.document-control {
  margin-top: 16px;
}

.document-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
}

.document-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.document-stats div {
  min-height: 76px;
  padding: 12px;
  border: 1px solid rgba(24, 91, 75, 0.14);
  border-radius: 6px;
  background: #fbf6e8;
}

.document-stats strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.document-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.document-actions button,
.document-toolbar button,
.detail-head button {
  background: var(--ink);
}

.document-actions button:nth-child(2) {
  background: var(--accent);
}

.document-actions button:nth-child(3) {
  background: #7a4d1d;
}

.document-detail {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(24, 91, 75, 0.2);
  border-radius: 8px;
  background: #fffaf0;
}

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

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

.document-detail pre {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 6px;
  background: #14221d;
  color: #f4f1e8;
  line-height: 1.55;
}

.prompt-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-bank button {
  background: #efe4cc;
  color: var(--ink);
  border: 1px solid rgba(24, 91, 75, 0.18);
  box-shadow: none;
}

.prompt-bank button:hover {
  background: var(--accent-3);
}

.output {
  white-space: pre-wrap;
  margin-top: 18px;
  background: #14221d;
  color: #f4f1e8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 20px;
  min-height: 180px;
  line-height: 1.55;
  box-shadow: var(--shadow);
}

.strategy-panel {
  position: relative;
  overflow: hidden;
}

.strategy-panel::before {
  content: "estratégia";
  position: absolute;
  right: 18px;
  top: 12px;
  color: rgba(24, 91, 75, 0.08);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 8vw, 112px);
  font-weight: 900;
  pointer-events: none;
}

.strategy-panel > * {
  position: relative;
}

.strategy-panel .panel-title {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(24, 91, 75, 0.14);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  z-index: 20;
}

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

.toast[data-type="success"] {
  background: var(--accent);
}

.toast[data-type="error"] {
  background: var(--accent-2);
}

@media (max-width: 1100px) {
  .topbar,
  .section-head,
  .login,
  .document-toolbar,
  .row,
  .two-col,
  .work-grid {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .document-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(24, 91, 75, 0.18);
  }

  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 20px;
  }
}
