﻿:root {
  color-scheme: dark;
  --bg: #06111c;
  --bg-soft: #091827;
  --panel: rgba(11, 25, 39, .88);
  --panel-solid: #0b1927;
  --panel-2: #102235;
  --line: rgba(140, 170, 196, .16);
  --line-strong: rgba(140, 170, 196, .28);
  --text: #f3f8f7;
  --muted: #92a9b8;
  --muted-2: #698092;
  --accent: #3ee0a0;
  --accent-strong: #22c984;
  --accent-soft: rgba(62, 224, 160, .10);
  --warn: #ffd15c;
  --danger: #ff7484;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% -10%, rgba(42, 145, 202, .20), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(62, 224, 160, .10), transparent 31rem),
    linear-gradient(180deg, #06111c 0%, #07131e 56%, #050d15 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.ambient {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  filter: blur(12px);
  opacity: .7;
}
.ambient-one { width: 360px; height: 360px; top: 14%; left: -220px; background: rgba(33, 115, 173, .16); border-radius: 50%; }
.ambient-two { width: 300px; height: 300px; bottom: 0; right: -180px; background: rgba(62, 224, 160, .10); border-radius: 50%; }

.topbar {
  height: 76px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 14, 23, .84);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: inline-flex; align-items: center; gap: 12px; min-width: max-content; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #46efae, #25c783);
  color: #062116;
  font-weight: 950;
  box-shadow: 0 10px 30px rgba(62, 224, 160, .22);
}
.brand-copy { display: grid; line-height: 1.05; gap: 4px; }
.brand-copy strong { letter-spacing: .08em; font-size: 14px; }
.brand-copy small { color: var(--muted); font-size: 9px; letter-spacing: .18em; }

.app-navigation { justify-self: center; display: flex; align-items: center; gap: 8px; }
.app-navigation a, .nav-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 13px;
  border-radius: 10px;
  font-weight: 750;
  cursor: pointer;
}
.app-navigation a:hover, .nav-button:hover { color: var(--text); background: rgba(255,255,255,.04); }

.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions select { width: 72px; }

.layout { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 70px; }
.workspace { display: grid; gap: 20px; }

.panel {
  background: linear-gradient(180deg, rgba(13, 29, 44, .93), rgba(8, 21, 33, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.035em; }
h2 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.15; letter-spacing: -.02em; }
h3 { font-size: 16px; }
p, small, label, dt { color: var(--muted); }

.auth-shell {
  min-height: calc(100vh - 152px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 480px);
  align-items: center;
  gap: clamp(40px, 8vw, 120px);
}
.auth-intro { padding: 30px 0; }
.auth-intro h2 { max-width: 760px; font-size: clamp(42px, 6.2vw, 78px); margin-bottom: 22px; }
.auth-intro > p { max-width: 690px; font-size: 18px; }
.auth-benefits { margin-top: 38px; display: grid; gap: 14px; }
.auth-benefits > div {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  max-width: 590px;
}
.auth-benefits span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(62, 224, 160, .30);
  border-radius: 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}
.auth-benefits p { margin: 0; color: var(--text); font-weight: 700; }
.auth-panel { padding: 34px; box-shadow: var(--shadow); }
.auth-badge {
  display: inline-flex;
  padding: 7px 10px;
  margin-bottom: 20px;
  border: 1px solid rgba(62,224,160,.28);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .13em;
}
.auth-panel h1 { font-size: 34px; margin-bottom: 10px; }
.auth-panel > p { margin-bottom: 24px; }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 20px; }
.auth-footnote { display: block; margin-top: 12px; font-size: 12px; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(4, 14, 23, .85);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(62, 224, 160, .66);
  box-shadow: 0 0 0 4px rgba(62,224,160,.08);
}
textarea { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; line-height: 1.45; }
label { display: grid; gap: 8px; margin: 14px 0; font-size: 13px; font-weight: 760; }

.button, button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 850;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, border-color .16s ease, background .16s ease;
}
.button:hover, button:hover { transform: translateY(-1px); }
.button:disabled, button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-primary {
  color: #062116;
  background: linear-gradient(135deg, #49edac, #2fd291);
  box-shadow: 0 10px 26px rgba(62,224,160,.15);
}
.button-primary:hover { filter: brightness(1.04); }
.button-secondary {
  color: var(--text);
  background: #12263a;
  border: 1px solid var(--line-strong);
}
.button-ghost {
  color: var(--muted);
  background: rgba(255,255,255,.025);
  border: 1px solid var(--line);
}
.button-danger {
  color: #ffd3d8;
  background: rgba(134, 38, 55, .26);
  border: 1px solid rgba(255,116,132,.28);
}
.full-width { width: 100%; }

.modal-wide {
  width: min(1120px, calc(100vw - 36px));
  max-height: min(900px, calc(100vh - 36px));
  overflow: auto;
}

.created-invoice-form {
  display: grid;
  gap: 16px;
}

.created-invoice-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 19, 30, .58);
}

.created-invoice-section h3 {
  margin-bottom: 12px;
}

.created-invoice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.created-invoice-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.created-invoice-summary strong {
  padding: 12px 14px;
  border: 1px solid rgba(62, 224, 160, .24);
  border-radius: 12px;
  background: rgba(62, 224, 160, .08);
}

.modal-actions {
  align-items: center;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-actions select {
  width: min(260px, 100%);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.vertical-actions { align-items: stretch; display: grid; gap: 9px; }
.vertical-actions .button { width: 100%; }

.dashboard-hero {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 34px 38px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(105deg, rgba(13, 33, 50, .96), rgba(7, 25, 37, .90)),
    radial-gradient(circle at 90% 30%, rgba(62,224,160,.18), transparent 26rem);
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -90px;
  top: -150px;
  border: 1px solid rgba(62,224,160,.15);
  border-radius: 50%;
}
.dashboard-hero h1 { margin-bottom: 10px; font-size: clamp(31px, 4vw, 50px); }
.dashboard-hero p { margin-bottom: 0; max-width: 700px; }
.hero-actions { display: flex; gap: 10px; position: relative; z-index: 1; }

.notice-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 209, 92, .26);
  border-radius: 16px;
  background: rgba(255, 209, 92, .07);
}
.notice-card p { margin: 3px 0 0; }
.notice-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #17200a;
  background: var(--warn);
  font-weight: 950;
}

.dashboard { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(13,29,44,.88), rgba(8,21,33,.88));
}
.metric-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(62,224,160,.08);
  border: 1px solid rgba(62,224,160,.18);
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
}
.metric small { display: block; margin-bottom: 4px; }
.metric strong { display: block; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.upload-card, .account-card, .documents-panel, .editor-panel { padding: 24px; }
.section-heading, .section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.section-heading h2, .section-head h2 { margin-bottom: 8px; }
.section-heading p { margin-bottom: 0; }
.section-heading.compact { margin-bottom: 10px; }
.module-control { width: min(260px, 100%); margin: 0; }

.drop-zone {
  min-height: 270px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  margin-top: 22px;
  padding: 26px;
  text-align: center;
  border: 1px dashed rgba(105, 161, 194, .50);
  border-radius: 16px;
  background: rgba(4, 16, 26, .68);
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.drop-zone.drag { border-color: var(--accent); background: rgba(62,224,160,.07); transform: scale(1.003); }
.upload-symbol {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(62,224,160,.22);
  font-size: 30px;
  font-weight: 500;
}
.drop-zone > strong { font-size: 18px; }
.drop-zone > span { color: var(--muted); font-size: 13px; }
.native-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-picker { display: inline-flex; width: auto; margin: 4px 0 0; cursor: pointer; }
#selectedFileName { min-height: 18px; color: var(--muted-2); overflow-wrap: anywhere; }
.upload-footer { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; margin-top: 16px; }
.progress { height: 8px; border-radius: 999px; background: #05101a; overflow: hidden; }
.progress span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, var(--accent-strong), #57f2b7); transition: width .22s ease; }

.account-card { position: sticky; top: 96px; }
.account-info, .subscription-info { margin: 0; display: grid; grid-template-columns: 1fr; gap: 4px; }
dl dt { margin-top: 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; }
dl dd { margin: 0; color: var(--text); font-weight: 800; overflow-wrap: anywhere; }
.account-divider { height: 1px; background: var(--line); margin: 20px 0; }
.account-card h3 { margin-bottom: 6px; }
.account-card .button { margin-top: 20px; }

.documents-panel { scroll-margin-top: 96px; }
.toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.toolbar input { min-width: 220px; }
.toolbar select { width: auto; min-width: 180px; }
.documents { display: grid; gap: 10px; margin-top: 22px; }
.doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 34, 52, .70);
}
.doc strong { display: block; margin-bottom: 4px; }
.doc small { display: block; }
.doc-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.editor-panel { scroll-margin-top: 96px; }
.field-form { display: grid; gap: 16px; margin-top: 20px; }
.field-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(8, 22, 35, .72);
}
.field-section h3 { margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row.needs-review input { border-color: rgba(255, 209, 92, .65); }
.confidence { color: var(--muted-2); font-size: 11px; }
.line-items { display: grid; gap: 10px; }
.line-item { display: grid; grid-template-columns: 2fr .8fr .8fr .8fr .8fr auto; gap: 8px; align-items: end; }
.line-item-einvoice { grid-template-columns: 2fr .7fr .7fr .9fr .9fr .7fr .8fr auto; }
.technical-json { margin-top: 18px; color: var(--muted); }
.technical-json summary { cursor: pointer; font-weight: 800; }
.technical-json textarea { margin-top: 12px; }
.editor-actions { margin-top: 18px; }
.exports-history { display: grid; gap: 8px; margin-top: 14px; color: var(--muted); }

.message { min-height: 20px; margin: 10px 0 0; font-weight: 750; }
.message.error { color: var(--danger); }
.message.success { color: var(--accent); }
.hidden { display: none !important; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; border-radius: 0; background: rgba(1, 7, 12, .80); backdrop-filter: blur(8px); }
.modal-backdrop:hover { transform: none; }
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  max-height: min(900px, calc(100vh - 48px));
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #0a1826;
  box-shadow: 0 35px 100px rgba(0,0,0,.55);
}
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin-bottom: 7px; }
.modal-header p { margin-bottom: 0; max-width: 760px; }
.modal-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: rgba(255,255,255,.03);
  font-size: 28px;
  line-height: 1;
}
.billing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 24px; margin-top: 24px; }
.billing-form { min-width: 0; }
.form-grid { display: grid; gap: 12px; }
.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid label { margin-top: 0; }
.billing-hint {
  padding: 13px 14px;
  border: 1px solid rgba(62,224,160,.25);
  border-radius: 13px;
  background: rgba(62,224,160,.07);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.billing-modules { margin: 16px 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; }
.billing-modules legend { padding: 0 7px; color: var(--muted); font-size: 12px; font-weight: 900; }
.billing-modules-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; }
.checkbox-row { display: grid; grid-template-columns: 18px 1fr; align-items: start; gap: 10px; margin: 10px 0; font-size: 12px; }
.checkbox-row input { width: auto; margin: 2px 0 0; padding: 0; accent-color: var(--accent-strong); }
.addon-row, .confirmation-row { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.02); }
.confirmation-row { border-color: rgba(255,209,92,.24); background: rgba(255,209,92,.05); }
.billing-checkout {
  align-self: start;
  position: sticky;
  top: 0;
  padding: 20px;
  border: 1px solid rgba(62,224,160,.20);
  border-radius: 17px;
  background: rgba(5, 17, 27, .88);
}
.billing-summary { display: grid; gap: 10px; margin: 8px 0 18px; font-size: 13px; }
.billing-summary-row { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(140,170,196,.09); }
.billing-summary-row strong { text-align: right; }
.billing-summary-total { margin-top: 3px; padding-top: 11px; border-top: 1px solid rgba(62,224,160,.25); border-bottom: 0; color: var(--accent); font-size: 15px; font-weight: 950; }
.billing-checkout > small { display: block; margin-top: 12px; font-size: 11px; }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: auto 1fr; }
  .app-navigation { display: none; }
  .top-actions { justify-self: end; }
  .workspace-grid { grid-template-columns: 1fr; }
  .account-card { position: static; }
  .billing-layout { grid-template-columns: 1fr; }
  .billing-checkout { position: static; }
}

@media (max-width: 860px) {
  .layout { width: min(100% - 24px, 1400px); padding-top: 22px; }
  .topbar { height: 68px; padding: 0 14px; gap: 10px; }
  .brand-copy { display: none; }
  .auth-shell { min-height: auto; grid-template-columns: 1fr; gap: 20px; }
  .auth-intro { padding: 22px 4px 0; }
  .auth-intro h2 { font-size: clamp(36px, 12vw, 56px); }
  .auth-panel { padding: 24px; }
  .dashboard-hero { min-height: 0; padding: 26px; align-items: flex-start; flex-direction: column; }
  .hero-actions { width: 100%; }
  .hero-actions .button { flex: 1; }
  .dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notice-card { grid-template-columns: auto 1fr; }
  .notice-card .button { grid-column: 1 / -1; width: 100%; }
  .section-heading, .section-head { flex-direction: column; align-items: stretch; }
  .module-control { width: 100%; }
  .toolbar input, .toolbar select, .toolbar .button { width: 100%; min-width: 0; }
  .field-grid, .line-item, .three-columns { grid-template-columns: 1fr; }
  .created-invoice-grid, .created-invoice-summary { grid-template-columns: 1fr; }
  .modal-actions { justify-content: stretch; }
  .modal-actions > * { width: 100%; }
  .doc { grid-template-columns: 1fr; }
  .billing-modules-grid { grid-template-columns: 1fr; }
  .modal { padding: 10px; }
  .modal-panel { max-height: calc(100vh - 20px); padding: 20px; border-radius: 17px; }
}

@media (max-width: 560px) {
  .dashboard { grid-template-columns: 1fr; }
  .auth-actions, .upload-footer { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .top-actions select { width: 62px; padding-inline: 8px; }
  .upload-card, .account-card, .documents-panel, .editor-panel { padding: 18px; }
  .drop-zone { min-height: 230px; padding: 20px 14px; }
}

/* Compatibility with controls created dynamically by cloud.js. */
button.secondary { color: var(--text); background: #12263a; border: 1px solid var(--line-strong); }
button.ghost { color: var(--muted); background: rgba(255,255,255,.025); border: 1px solid var(--line); }
button.danger { color: #ffd3d8; background: rgba(134,38,55,.26); border: 1px solid rgba(255,116,132,.28); }
