:root {
  --ink: #17211b;
  --muted: #68746c;
  --line: #dce4de;
  --paper: #ffffff;
  --canvas: #f6f8f5;
  --green: #1e5a3d;
  --green-dark: #16452f;
  --lime: #c9f36a;
  --danger: #a13b32;
  --shadow: 0 22px 60px rgba(27, 55, 38, 0.1);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 35%, rgba(214, 235, 220, 0.36), transparent 29rem),
    var(--canvas);
  font-family: "DM Sans", sans-serif;
}

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

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 14px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(211, 221, 214, 0.85);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--lime); background: var(--green); }
.brand-mark svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.brand small, .brand strong { display: block; }
.brand small { margin-bottom: 1px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.brand strong { font-family: Manrope, sans-serif; font-size: 17px; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .upload-zone:focus-visible, .icon-button:focus-visible { outline: 3px solid rgba(30, 90, 61, .2); outline-offset: 2px; }
.button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { color: white; background: var(--green); box-shadow: 0 10px 24px rgba(30, 90, 61, .16); }
.button-primary:hover:not(:disabled) { background: var(--green-dark); box-shadow: 0 13px 28px rgba(30, 90, 61, .22); }
.button-primary:disabled { opacity: .46; cursor: not-allowed; box-shadow: none; }
.button-secondary { border-color: var(--line); background: white; }
.button-secondary svg { width: 18px; }
.button-ghost { color: var(--danger); background: transparent; }

.workspace { width: min(100% - 32px, 1440px); min-height: calc(100vh - 79px); margin: 0 auto; }
.welcome-panel { display: grid; max-width: 760px; min-height: calc(100vh - 79px); margin: auto; padding: 10vh 0 7vh; place-items: center; align-content: center; text-align: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow > span { width: 22px; height: 2px; background: var(--lime); }

h1 { margin: 18px 0 18px; font-family: Manrope, sans-serif; font-size: clamp(42px, 6vw, 72px); line-height: 1.03; letter-spacing: -.055em; }
h1 em { color: var(--green); font-style: normal; }
.welcome-panel > p { max-width: 590px; margin: 0 0 34px; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.65; }

.action-card { width: min(100%, 650px); padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.upload-zone { display: flex; width: 100%; min-height: 92px; padding: 16px; align-items: center; gap: 15px; border: 1px dashed #b8c8bd; border-radius: 12px; background: #fafcf9; text-align: left; cursor: pointer; transition: border-color .18s, background .18s; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: var(--green); background: #f3f8f4; }
.upload-zone.has-file { border-style: solid; border-color: #8eb39d; background: #f3f9f5; }
.upload-icon { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 12px; color: var(--green); background: #e5f0e8; }
.upload-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-copy { min-width: 0; flex: 1; }
.upload-copy strong, .upload-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-copy strong { margin-bottom: 5px; font-size: 15px; }
.upload-copy small { color: var(--muted); font-size: 12px; }
.select-label { padding: 8px 11px; border-radius: 7px; color: var(--green); background: #e8f1ea; font-size: 12px; font-weight: 700; }
.action-card > .button { width: 100%; min-height: 53px; margin-top: 12px; }
.action-card > .button svg { margin-left: auto; }

.status-message { min-height: 24px; margin-top: 15px; color: var(--muted); font-size: 14px; }
.status-message.is-error { color: var(--danger); }
.status-message.is-loading::before { display: inline-block; width: 13px; height: 13px; margin-right: 8px; border: 2px solid #b9c9be; border-top-color: var(--green); border-radius: 50%; content: ""; vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dashboard-ready-panel { width: min(100%, 650px); margin-top: 12px; padding: 18px; border: 1px solid #bcd7c5; border-radius: 16px; background: #f3faf5; text-align: left; box-shadow: 0 14px 34px rgba(30, 90, 61, .08); }
.dashboard-ready-panel[hidden] { display: none; }
.ready-heading { display: flex; align-items: center; gap: 12px; }
.ready-heading strong, .ready-heading small { display: block; }
.ready-heading strong { margin-bottom: 3px; font-family: Manrope, sans-serif; font-size: 16px; }
.ready-heading small { color: var(--muted); font-size: 12px; }
.ready-icon { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: white; background: var(--green); }
.ready-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ai-warning { margin: 14px 0; padding: 10px 12px; border-radius: 9px; color: #775a25; background: #fff8e9; font-size: 12px; line-height: 1.5; }
.ready-actions { display: flex; justify-content: flex-end; gap: 9px; }

.privacy-note { display: flex; max-width: 590px; margin-top: 27px; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: left; }
.privacy-note svg { width: 18px; flex: 0 0 auto; fill: none; stroke: var(--green); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

#dashboard-render-zone { display: none; }
#dashboard-render-zone.is-visible { position: fixed; z-index: 1000; inset: 0; display: block; background: #eef2ef; }
.dashboard-shell { display: flex; width: 100%; height: 100dvh; flex-direction: column; }
.dashboard-toolbar { display: flex; min-height: 68px; padding: 10px clamp(14px, 3vw, 34px); align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: white; box-shadow: 0 4px 18px rgba(20, 42, 28, .07); }
.dashboard-toolbar-copy { min-width: 0; }
.dashboard-toolbar-copy strong, .dashboard-toolbar-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-toolbar-copy strong { font-family: Manrope, sans-serif; font-size: 16px; }
.dashboard-toolbar-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.dashboard-toolbar-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.dashboard-toolbar .button { min-height: 42px; }
.dashboard-frame { width: 100%; min-height: 0; flex: 1; border: 0; background: white; }
body.dashboard-open { overflow: hidden; }

.settings-dialog { width: min(94vw, 610px); max-height: 90vh; padding: 0; border: 0; border-radius: 20px; background: white; box-shadow: 0 30px 100px rgba(12, 28, 18, .24); }
.settings-dialog::backdrop { background: rgba(19, 32, 24, .5); backdrop-filter: blur(4px); }
.settings-dialog form { padding: 28px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 25px; }
.dialog-header h2 { margin: 8px 0 0; font-family: Manrope, sans-serif; font-size: 28px; letter-spacing: -.03em; }
.icon-button { display: grid; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: white; place-items: center; cursor: pointer; }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field > span:first-child { font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfcfb; outline: none; transition: border-color .18s, box-shadow .18s; }
.field input, .field select { height: 45px; padding: 0 12px; }
.field select { cursor: pointer; }
.field textarea { min-height: 150px; padding: 12px; line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30,90,61,.1); }
.field small { color: var(--muted); font-size: 11px; }
.password-control { position: relative; }
.password-control input { padding-right: 55px; }
.password-control button { position: absolute; top: 50%; right: 7px; padding: 6px 8px; border: 0; color: var(--green); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; transform: translateY(-50%); }
.advanced-prompt { margin: -2px 0 18px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfb; }
.advanced-prompt summary { padding: 12px 14px; color: var(--green); font-size: 12px; font-weight: 800; cursor: pointer; user-select: none; }
.advanced-prompt[open] summary { border-bottom: 1px solid var(--line); }
.advanced-prompt .field { margin: 0; padding: 14px; }
.warning-box { display: flex; margin: 4px 0 22px; padding: 12px 14px; flex-direction: column; gap: 3px; border-left: 3px solid #d8a74e; color: #775a25; background: #fff8e9; font-size: 12px; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 600px) {
  .app-header { min-height: 68px; padding: 10px 16px; }
  .brand small { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .button-secondary { width: 44px; padding: 0; font-size: 0; }
  .welcome-panel { min-height: calc(100vh - 69px); padding: 55px 0 40px; }
  h1 { font-size: clamp(38px, 12vw, 52px); }
  .action-card { padding: 10px; }
  .upload-zone { align-items: flex-start; }
  .select-label { display: none; }
  .settings-dialog form { padding: 21px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  .ready-actions { flex-direction: column-reverse; }
  .ready-actions .button { width: 100%; }
  .dashboard-toolbar { min-height: 62px; }
  .dashboard-toolbar-actions .button-secondary { width: auto; padding: 0 12px; font-size: 12px; }
  .dashboard-toolbar-copy small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
