:root {
  color-scheme: light dark;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --ink: #102033;
  --muted: #647084;
  --line: #dce5ef;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --accent: #2563eb;
  --green: #15803d;
  --red: #dc2626;
  --amber: #d97706;
  --violet: #6d28d9;
  --shadow: 0 20px 55px rgba(15, 35, 65, 0.11), 0 1px 2px rgba(15, 35, 65, 0.07);
  --input-bg: #fff;
  --status-bg: #eef5f7;
  --panel-bg-alt: #f8fbfe;
  --panel-top: rgba(255, 255, 255, 0.92);
  --canvas-bg: #fbfdff;
  --focus-ring: rgba(20, 184, 166, 0.24);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b12;
    --panel: #111720;
    --panel-solid: #111720;
    --ink: #f4f8fb;
    --muted: #98a6ba;
    --line: #263244;
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --accent: #60a5fa;
    --green: #22c55e;
    --red: #f87171;
    --amber: #f59e0b;
    --violet: #a78bfa;
    --shadow: 0 24px 58px rgba(0, 0, 0, 0.34), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
    --input-bg: #0c121b;
    --status-bg: #172230;
    --panel-bg-alt: #0c121b;
    --panel-top: rgba(17, 23, 32, 0.92);
    --canvas-bg: #0a1018;
    --focus-ring: rgba(45, 212, 191, 0.22);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080b12;
  --panel: #111720;
  --panel-solid: #111720;
  --ink: #f4f8fb;
  --muted: #98a6ba;
  --line: #263244;
  --primary: #2dd4bf;
  --primary-strong: #5eead4;
  --accent: #60a5fa;
  --green: #22c55e;
  --red: #f87171;
  --amber: #f59e0b;
  --violet: #a78bfa;
  --shadow: 0 24px 58px rgba(0, 0, 0, 0.34), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --input-bg: #0c121b;
  --status-bg: #172230;
  --panel-bg-alt: #0c121b;
  --panel-top: rgba(17, 23, 32, 0.92);
  --canvas-bg: #0a1018;
  --focus-ring: rgba(45, 212, 191, 0.22);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --ink: #102033;
  --muted: #647084;
  --line: #dce5ef;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --accent: #2563eb;
  --green: #15803d;
  --red: #dc2626;
  --amber: #d97706;
  --violet: #6d28d9;
  --shadow: 0 20px 55px rgba(15, 35, 65, 0.11), 0 1px 2px rgba(15, 35, 65, 0.07);
  --input-bg: #fff;
  --status-bg: #eef5f7;
  --panel-bg-alt: #f8fbfe;
  --panel-top: rgba(255, 255, 255, 0.92);
  --canvas-bg: #fbfdff;
  --focus-ring: rgba(20, 184, 166, 0.24);
}


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 240px),
    var(--bg);
  background-size: 56px 56px, 56px 56px, 100% 100%, auto;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-top);
  box-shadow: var(--shadow);
  padding: 16px;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--amber));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.6rem, 2.6vw, 2.35rem);
}

h2 {
  font-size: 1.05rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.text-logo {
  font-size: clamp(2.2rem, 3.2vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-strong) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-top: 2px;
}

.text-logo .dot {
  -webkit-text-fill-color: var(--amber);
}

.brand-line {
  display: block;
  max-width: 520px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.account-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(118px, auto)) auto auto;
  gap: 10px;
  align-items: stretch;
  position: relative;
  z-index: 1;
  max-width: 100%;
}

.account-strip > div,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.account-strip > div {
  background: var(--panel-bg-alt);
  padding: 10px 12px;
  min-height: 62px;
}

.account-strip span,
.risk-list span,
.metric-row span,
.condition-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.account-strip strong,
.risk-list strong,
.metric-row strong,
.condition-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 16px;
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 42px),
    var(--panel);
}

.controls-panel {
  position: sticky;
  top: 16px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

select,
input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

select:focus,
input:focus,
button:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.primary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--primary-strong), var(--accent));
}

.primary-button:disabled {
  cursor: not-allowed;
  background: var(--muted);
  opacity: 0.7;
}

.ghost-button {
  background: var(--panel-bg-alt);
  border-color: var(--line);
  color: var(--ink);
}

.ghost-button:hover {
  border-color: color-mix(in srgb, var(--primary), var(--line) 45%);
  color: var(--primary);
}

.full {
  width: 100%;
}

.small {
  width: auto;
  min-height: 36px;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

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

.settings-form {
  display: grid;
  gap: 0;
}

.risk-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.chart-panel,
.metrics-panel,
.conditions-panel,
.trades-panel {
  min-width: 0;
}

.chart-panel {
  grid-column: 1 / -1;
}

.signal-panel {
  grid-row: span 2;
}

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

.panel-head.compact {
  margin-bottom: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  min-height: 32px;
  border-radius: 999px;
  background: var(--status-bg);
  color: var(--muted);
  font-weight: 900;
  font-size: 0.82rem;
}

.status-pill.execute {
  background: var(--status-bg);
  color: var(--green);
}

.status-pill.watch {
  background: var(--status-bg);
  color: var(--amber);
}

.status-pill.skip {
  background: var(--status-bg);
  color: var(--red);
}

canvas {
  display: block;
  width: 100%;
  height: 600px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(100, 112, 132, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 112, 132, 0.08) 1px, transparent 1px),
    var(--canvas-bg);
  background-size: 42px 42px, 42px 42px, auto;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.toolbar-field {
  display: grid;
  grid-template-columns: auto minmax(92px, 118px);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-bg-alt);
  padding: 4px 6px 4px 10px;
}

.toolbar-field label {
  white-space: nowrap;
}

.toolbar-field select {
  height: 32px;
  border-radius: 5px;
  padding: 0 8px;
}

.live-strip {
  display: grid;
  grid-template-columns: minmax(min(100%, 220px), 1.4fr) repeat(3, minmax(min(100%, 150px), 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.live-strip > div {
  min-width: 0;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg-alt);
  padding: 9px 10px;
}

.live-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.live-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.live-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-dot {
  width: 10px;
  min-width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  opacity: 0.5;
}

.live-dot.active {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--status-bg);
  opacity: 1;
}

.interval-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.82rem;
}

.interval-box strong {
  color: var(--ink);
  font-size: 0.88rem;
  text-align: right;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.signal-grid div {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-bg-alt);
}

.signal-grid .wide {
  grid-column: 1 / -1;
  min-height: 76px;
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.94rem;
  font-weight: 750;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr));
  gap: 10px;
}

.metric-row > div,
.condition-grid > div,
.tools-grid > div {
  min-width: 0;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-bg-alt);
  overflow: hidden;
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  gap: 10px;
}

.metric-row strong,
.condition-grid strong,
.market-data-grid strong,
.interval-stats strong {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.trades-panel {
  grid-column: 1 / -1;
}

.interval-panel,
.intel-panel {
  grid-column: 1 / -1;
}

.interval-result {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg-alt);
  padding: 12px;
}

.interval-result strong {
  font-size: 1.05rem;
}

.interval-stats,
.market-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
}

.interval-stats div,
.market-data-grid div,
.news-list article,
.driver-list div,
.event-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg-alt);
  padding: 10px;
}

.interval-stats span,
.market-data-grid span,
.news-list span,
.driver-list span,
.event-list span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.interval-stats strong,
.market-data-grid strong {
  display: block;
  margin-top: 4px;
}

.intel-columns {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 12px;
  margin-top: 12px;
}

h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.news-list,
.driver-list,
.event-list {
  display: grid;
  gap: 8px;
}

.news-list strong,
.driver-list strong,
.event-list strong {
  display: block;
  margin-top: 3px;
  font-size: 0.92rem;
}

.source-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.tools-panel {
  grid-column: 1 / -1;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr));
  gap: 10px;
}

.tool-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--status-bg);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
}

.tool-category {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--status-bg);
  color: var(--muted);
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 850;
}

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

.tool-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-signal {
  margin-top: 7px;
  color: var(--primary);
  font-weight: 900;
}

.tool-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.scanner-panel {
  grid-column: 1 / -1;
}

.scanner-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 10px;
}

.scanner-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 10px;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg-alt);
  padding: 11px;
  text-align: left;
  cursor: pointer;
}

.scanner-item:hover {
  border-color: var(--primary);
}

.scanner-item strong,
.scanner-item span {
  display: block;
}

.scanner-item .asset-code {
  font-size: 1rem;
}

.scanner-item .scanner-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
}

.scanner-item .score {
  align-self: start;
  border-radius: 999px;
  background: var(--status-bg);
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.scanner-item.execute .score {
  background: var(--status-bg);
  color: var(--green);
}

.scanner-item.watch .score {
  background: var(--status-bg);
  color: var(--amber);
}

.trade-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
}

.empty,
.muted {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .workspace,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .account-strip {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    width: 100%;
  }

  .account-strip .ghost-button {
    grid-column: span 1;
  }

  .controls-panel {
    position: public;
  }

  .signal-panel {
    grid-row: auto;
  }

}


@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 14px;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .account-strip {
    grid-template-columns: 1fr;
  }

  .signal-grid,
  .condition-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }

  canvas {
    height: 420px;
    min-height: 420px;
  }

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

  .live-strip {
    grid-template-columns: 1fr;
  }
}


.app-footer {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  padding: 24px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-wrap p {
  margin: 0;
}

.footer-wrap nav {
  display: flex;
  gap: 16px;
}

.footer-wrap a {
  color: var(--muted);
  text-decoration: none;
}

.footer-wrap a:hover {
  color: var(--primary);
}


.app-modal {
  border: none;
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow);
  max-width: 500px;
  width: 100%;
}
.app-modal::backdrop {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}
.app-modal .modal-content {
  display: flex;
  flex-direction: column;
}
.app-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.app-modal header h3 { margin: 0; font-size: 1.1rem; }
.app-modal .modal-body {
  padding: 20px;
  line-height: 1.5;
  font-size: 0.95rem;
}
.app-modal .ghost-button { border: none; font-size: 1.4rem; padding: 0; height: 32px; width: 32px;}
.tool-box {
  cursor: pointer;
  transition: all 0.2s ease;
}
.tool-box:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}


.status-pill { border: 1px solid var(--primary); }
.status-pill.execute { border-color: var(--green); background: rgba(21, 128, 61, 0.1); }
.status-pill.watch { border-color: var(--amber); background: rgba(217, 119, 6, 0.1); }
.status-pill.skip { border-color: var(--red); background: rgba(220, 38, 38, 0.1); }
.tool-box { border-left: 4px solid var(--accent); }
.panel { border-top: 3px solid var(--primary); }
.chart-panel { border-top: 3px solid var(--accent); }


/* ============================================================
   Trading-Tagebuch (Journal) styles
   ============================================================ */

.journal-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.journal-chart-wrap {
  position: relative;
  height: 200px;
  margin-top: 12px;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 12px;
}

.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.journal-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--panel-bg-alt);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.journal-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

.journal-table tbody tr:last-child td { border-bottom: none; }
.journal-table tbody tr:hover { background: var(--panel-bg-alt); }

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0 !important;
  white-space: normal !important;
}

.pnl-pos { color: var(--green); font-weight: 700; }
.pnl-neg { color: var(--red);   font-weight: 700; }
.pnl-zero { color: var(--muted); }
.dir-long  { color: var(--green); font-weight: 700; }
.dir-short { color: var(--red);   font-weight: 700; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge-open   { background: rgba(217,119,6,0.12); color: var(--amber); border-color: var(--amber); }
.badge-closed { background: rgba(21,128,61,0.1);  color: var(--green); border-color: var(--green); }

.action-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 4px;
}
.action-btn:hover { color: var(--primary); border-color: var(--primary); }
.action-btn.danger:hover { color: var(--red); border-color: var(--red); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 18, 0.65);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px 28px;
}
.image-modal-box { width: min(900px, 100%); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}
.modal-header h2 { margin: 0; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
}
.field-full { grid-column: 1 / -1; }

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  font: inherit;
}
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.upload-zone {
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  background: var(--panel-bg-alt);
}
.upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(15, 118, 110, 0.05);
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}
.upload-icon { font-size: 1.8rem; }
.upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--ink);
}
.upload-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.link-button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}
.muted-text { color: var(--muted); }

.form-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid var(--red);
  border-radius: 6px;
  color: var(--red);
  font-size: 0.87rem;
  padding: 10px 14px;
  margin-top: 12px;
}

@media (max-width: 740px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .controls-panel { position: public; }
}
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Admin Backend styles
   ============================================================ */

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0;
}

.admin-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  border-radius: 6px 6px 0 0;
  transition: color 0.15s;
}

.admin-tab:hover { color: var(--ink); }

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
