:root {
  --bg: #08111b;
  --surface: #101b28;
  --surface-soft: #162434;
  --ink: #eef5fb;
  --muted: #91a3b5;
  --line: #26384a;
  --accent: #14b8a6;
  --accent-strong: #2dd4bf;
  --blue: #2563eb;
  --blue-strong: #60a5fa;
  --amber: #b7791f;
  --amber-strong: #f6c45f;
  --warn: #f87171;
  --warn-strong: #ef4444;
  --warn-soft: rgba(248, 113, 113, 0.14);
  --good: #4ade80;
  --good-soft: rgba(74, 222, 128, 0.13);
  --sidebar: #060d15;
  --sidebar-soft: #0d1722;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color-scheme: dark;
  background:
    radial-gradient(circle at 20% 0%, rgba(20, 184, 166, 0.14) 0%, transparent 30%),
    linear-gradient(180deg, #0b1622 0%, var(--bg) 48%, #050b12 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(20, 184, 166, 0.16) 0%, transparent 34%),
    rgba(5, 11, 18, 0.94);
  backdrop-filter: blur(14px);
}

.auth-panel {
  display: grid;
  width: min(440px, 100%);
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, #101b28 0%, #09131e 100%);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 6px;
}

.auth-panel label {
  display: grid;
  gap: 8px;
  color: #b7c7d8;
  font-weight: 800;
}

.auth-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07121d;
  color: var(--ink);
  padding: 14px 16px;
  outline: none;
}

.auth-panel input:focus {
  border-color: rgba(45, 212, 191, 0.65);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.auth-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.compact-heading {
  margin-bottom: 0;
}

.toggle-line {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.toggle-line span {
  display: grid;
  gap: 4px;
}

.toggle-line small {
  color: var(--muted);
  font-weight: 700;
}

.toggle-line input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: 18px;
  margin-bottom: 18px;
}

.admin-panel {
  align-items: stretch;
}

.admin-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.admin-stat-row div,
.admin-user-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(7, 18, 29, 0.64);
}

.admin-stat-row div {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.admin-stat-row span,
.admin-user-card small {
  color: var(--muted);
  font-weight: 800;
}

.admin-stat-row strong {
  font-size: 1.45rem;
}

.admin-users {
  display: grid;
  gap: 12px;
}

.admin-user-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, minmax(105px, auto)) minmax(210px, auto) minmax(130px, 0.8fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
}

.admin-user-main {
  display: grid;
  gap: 4px;
}

.admin-user-card strong {
  color: var(--ink);
}

.admin-badge {
  justify-self: start;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-weight: 900;
}

.admin-badge.good {
  border-color: rgba(74, 222, 128, 0.36);
  color: var(--good);
}

.admin-badge.warn {
  border-color: rgba(248, 113, 113, 0.36);
  color: var(--warn);
}

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

.admin-actions button {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.74);
  color: var(--ink);
  padding: 7px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

@media (max-width: 980px) {
  .admin-grid,
  .admin-user-card {
    grid-template-columns: 1fr;
  }
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
}

button:active:not(:disabled) {
  transform: translateY(2px) scale(0.99);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 26px;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, #0e1a27 0%, var(--sidebar) 48%, #04080d 100%);
  color: #f7faf7;
}

.brand,
.connection-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(94, 234, 212, 0.18);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, #5eead4 0%, #bef264 100%);
  color: #061018;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(94, 234, 212, 0.18);
}

.marketing-site {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 4%, rgba(14, 165, 233, 0.24), transparent 24%),
    radial-gradient(circle at 76% 24%, rgba(245, 158, 11, 0.16), transparent 25%),
    linear-gradient(135deg, rgba(2, 7, 19, 0.98) 0%, rgba(6, 16, 31, 0.99) 48%, rgba(2, 6, 16, 1) 100%);
  color: #f8fafc;
}

.marketing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.marketing-brand,
.marketing-nav nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.marketing-brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.22rem;
  font-weight: 950;
}

.marketing-brand img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #06101f;
  outline: 1px solid rgba(251, 191, 36, 0.62);
  box-shadow: 0 14px 34px rgba(14, 165, 233, 0.28);
}

.marketing-nav nav a {
  color: #c8d7e6;
  text-decoration: none;
  font-weight: 850;
  padding: 10px 12px;
}

.marketing-nav nav a:hover {
  color: #fbbf24;
}

.hero-section,
.marketing-band,
.feature-grid,
.pricing-section {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(460px, 1fr);
  gap: 46px;
  align-items: center;
  min-height: calc(100vh - 170px);
  padding: 28px 0 76px;
}

.hero-visual {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.hero-logo {
  display: block;
  width: clamp(132px, 17vw, 210px);
  height: clamp(132px, 17vw, 210px);
  margin: 0 auto 24px 0;
  border-radius: 34px;
  background: #06101f;
  outline: 1px solid rgba(251, 191, 36, 0.7);
  box-shadow:
    0 30px 90px rgba(14, 165, 233, 0.32),
    0 0 60px rgba(251, 191, 36, 0.2);
}

.hero-kicker {
  width: fit-content;
  margin: 0 0 18px;
  border: 1px solid rgba(14, 165, 233, 0.34);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.1);
  color: #bfdbfe;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 950;
  letter-spacing: 0;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(4rem, 7vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0;
  max-width: 7ch;
  text-transform: uppercase;
  font-weight: 950;
  text-shadow: 0 18px 44px rgba(14, 165, 233, 0.22);
}

.hero-copy p {
  width: min(720px, 100%);
  margin: 22px 0 0;
  color: #c2d1df;
  font-size: clamp(1.12rem, 2.2vw, 1.5rem);
  line-height: 1.55;
}

.hero-copy .hero-tagline {
  width: fit-content;
  margin: 14px 0 0;
  color: #f8e4a2;
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-proof span {
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.66);
  color: #f8fafc;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 900;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.marketing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  text-decoration: none;
}

.ghost-button {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
  color: var(--ink);
  padding: 12px 18px;
  font-weight: 950;
}

.hero-product {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 29, 43, 0.96), rgba(6, 14, 23, 0.96));
  padding: 22px;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.45),
    0 0 48px rgba(14, 165, 233, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand-hero-card {
  overflow: hidden;
  padding: 0;
  border-color: rgba(251, 191, 36, 0.28);
  background: #020713;
  box-shadow:
    0 34px 90px rgba(14, 165, 233, 0.2),
    0 0 42px rgba(251, 191, 36, 0.1);
}

.brand-hero-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.monitor-preview {
  padding: 18px;
}

.preview-top,
.preview-rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-top span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--good);
  box-shadow: 0 0 0 8px rgba(74, 222, 128, 0.11);
}

.preview-top small,
.preview-rule span,
.preview-metrics span {
  color: var(--muted);
  font-weight: 800;
}

.preview-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.preview-metrics div,
.preview-rule {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(7, 18, 29, 0.72);
  padding: 14px;
}

.preview-metrics div {
  display: grid;
  gap: 8px;
}

.preview-line {
  height: 90px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 0 18%, rgba(14, 165, 233, 0.95) 18% 21%, transparent 21% 36%, rgba(251, 191, 36, 0.9) 36% 39%, transparent 39% 58%, rgba(96, 165, 250, 0.9) 58% 61%, transparent 61%),
    linear-gradient(180deg, rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.03));
}

.marketing-band,
.pricing-section {
  display: grid;
  grid-template-columns: 0.8fr 1fr auto;
  gap: 24px;
  align-items: center;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding: 44px 0;
}

.how-section {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 28px;
  align-items: start;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding: 48px 0;
}

.marketing-band h2,
.pricing-section h2,
.how-section h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.marketing-band p,
.pricing-card p,
.feature-grid p {
  color: #b8c8d7;
  line-height: 1.55;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 22px 0 48px;
}

.feature-grid article,
.pricing-card,
.how-list li {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(8, 17, 27, 0.7);
  padding: 22px;
}

.how-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
}

.how-list span {
  grid-row: span 2;
  color: #fbbf24;
  font-weight: 950;
}

.how-list strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.how-list p {
  margin: 0;
  color: #b8c8d7;
  line-height: 1.5;
}

.feature-grid h3,
.pricing-card span {
  margin: 0 0 12px;
  color: var(--ink);
}

.pricing-card {
  display: grid;
  gap: 12px;
}

.pricing-card strong {
  font-size: 2.5rem;
}

.pricing-card small {
  color: var(--muted);
  font-size: 1rem;
}

@media (max-width: 900px) {
  .marketing-nav,
  .hero-section,
  .marketing-band,
  .pricing-section,
  .feature-grid,
  .how-section {
    width: min(100% - 28px, 680px);
  }

  .marketing-nav,
  .marketing-band,
  .pricing-section,
  .how-section {
    grid-template-columns: 1fr;
  }

  .marketing-nav {
    align-items: flex-start;
    gap: 14px;
    flex-direction: column;
  }

  .hero-section,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
    padding-top: 28px;
  }

  .hero-product {
    min-width: 0;
  }

  .preview-metrics {
    grid-template-columns: 1fr;
  }
}

.brand span,
.connection-panel span,
.metric span,
.metric small,
.eyebrow,
.fine-print {
  color: var(--muted);
}

.sidebar .brand span,
.sidebar .connection-panel span {
  color: #93a4b5;
}

.sidebar .brand strong {
  letter-spacing: 0;
}

.brand strong,
.brand span,
.connection-panel strong,
.connection-panel span {
  display: block;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a {
  padding: 11px 12px;
  border-radius: 8px;
  color: #c8d5e0;
  text-decoration: none;
  font-weight: 750;
}

.nav-list a.active,
.nav-list a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #5eead4;
}

.discipline-panel {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 0 2px;
}

.discipline-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.discipline-heading span {
  color: #93a4b5;
  font-size: 11px;
  font-weight: 850;
}

.discipline-heading strong {
  color: #f8fafc;
  font-size: 24px;
  line-height: 1;
}

.discipline-bar {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
}

.discipline-bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2dd4bf 0%, #bef264 100%);
}

.connection-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: #e2b84c;
  box-shadow: 0 0 0 5px rgba(226, 184, 76, 0.12);
}

.status-dot.connected {
  background: #61d394;
  box-shadow: 0 0 0 5px rgba(97, 211, 148, 0.13);
}

.status-dot.stopped {
  background: #ef705d;
  box-shadow: 0 0 0 5px rgba(239, 112, 93, 0.14);
}

.workspace {
  width: min(1320px, 100%);
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(38, 56, 74, 0.92);
  border-radius: 8px;
  background: rgba(16, 27, 40, 0.76);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.topbar h1,
.section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.section-heading h2 {
  font-size: 20px;
  line-height: 1.1;
}

.topbar h1 {
  font-size: clamp(28px, 3.6vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.topbar-clock {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 170px;
}

.topbar-clock span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.topbar-clock strong {
  color: var(--ink);
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions,
.form-actions,
.action-controls,
.time-row {
  display: flex;
  gap: 10px;
}

.primary-button,
.ghost-button,
.danger-button,
.warning-button,
.info-button,
.connect-button,
.liquidate-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(17, 24, 39, 0.14);
}

.compact-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.primary-button:focus-visible,
.ghost-button:focus-visible,
.danger-button:focus-visible,
.warning-button:focus-visible,
.info-button:focus-visible,
.connect-button:focus-visible,
.liquidate-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.primary-button {
  background: linear-gradient(180deg, #21c8ba 0%, #0f766e 100%);
  color: #061018;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.danger-button {
  background: var(--warn);
  color: #ffffff;
}

.danger-button:hover:not(:disabled) {
  background: var(--warn-strong);
}

.warning-button {
  background: rgba(246, 196, 95, 0.12);
  border-color: rgba(246, 196, 95, 0.38);
  color: var(--amber-strong);
}

.warning-button:hover:not(:disabled) {
  background: rgba(246, 196, 95, 0.2);
}

.info-button,
.connect-button {
  background: linear-gradient(180deg, #3b82f6 0%, var(--blue) 100%);
  color: #ffffff;
}

.info-button:hover:not(:disabled),
.connect-button:hover:not(:disabled) {
  background: var(--blue-strong);
}

.liquidate-button {
  background: linear-gradient(180deg, #ef6a5e 0%, var(--warn) 100%);
  color: #ffffff;
}

.liquidate-button:hover:not(:disabled) {
  background: var(--warn-strong);
}

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

.ghost-button:hover:not(:disabled) {
  background: var(--surface-soft);
}

.armed-button,
.armed-button:disabled {
  border-color: #7b8794;
  background:
    linear-gradient(145deg, #d8e1ea 0%, #8b98a6 46%, #485767 100%);
  color: #07101a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(0, 0, 0, 0.16),
    0 3px 0 rgba(17, 24, 39, 0.22);
  opacity: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.metric,
.rules-panel,
.monitor-panel,
.activity-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  min-height: 92px;
  overflow: hidden;
  padding: 15px 16px;
}

.metric::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  content: "";
}

.metric strong {
  display: block;
  margin: 8px 0 5px;
  font-size: clamp(20px, 1.75vw, 26px);
  line-height: 1;
}

.metric span {
  font-size: 12px;
  font-weight: 800;
}

.metric small {
  display: block;
  min-height: 15px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric.danger strong,
.metric.danger small {
  color: var(--warn);
}

.metric.danger::before {
  background: var(--warn);
}

.metric.success strong {
  color: var(--good);
}

.metric.success::before {
  background: var(--good);
}

.summary-grid .metric {
  min-height: 70px;
  padding: 11px 12px 10px;
}

.summary-grid .metric::before {
  height: 2px;
}

.summary-grid .metric strong {
  margin: 6px 0 0;
  font-size: clamp(17px, 1.28vw, 21px);
}

.summary-grid .metric span {
  font-size: 11px;
  line-height: 1.1;
}

.summary-grid .metric small {
  display: block;
  min-height: 14px;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.1;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  align-items: stretch;
}

.rules-panel,
.monitor-panel,
.activity-section,
.performance-section {
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.rules-panel .section-heading {
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.journal-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monitor-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.broker-status-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.broker-status-lamp {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12), 0 0 14px rgba(239, 68, 68, 0.55);
}

.broker-status-lamp.connected {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12), 0 0 14px rgba(34, 197, 94, 0.55);
}

.export-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #111927;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.export-button:hover {
  border-color: rgba(20, 184, 166, 0.52);
  background: #172234;
  transform: none;
}

.lock-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0;
  background: rgba(13, 23, 34, 0.9);
  color: var(--muted);
  font-weight: 800;
  cursor: default;
}

.lock-toggle:hover {
  border-color: rgba(20, 184, 166, 0.58);
  color: var(--ink);
}

.lock-icon {
  position: relative;
  width: 18px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 4px;
  color: var(--accent-strong);
}

.lock-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -11px;
  width: 8px;
  height: 10px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.lock-toggle.locked .lock-icon {
  color: var(--warn);
}

.lock-toggle.unlocked .lock-icon::before {
  left: 8px;
  top: -10px;
  transform: rotate(28deg);
  transform-origin: bottom left;
}

.lock-toggle.blocked .lock-icon {
  color: var(--warn);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.rule-field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.rules-panel .rule-field {
  grid-template-columns: minmax(0, 1fr) minmax(96px, 116px);
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.rule-field-header {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.rule-field-header > span {
  min-width: 0;
}

.rules-panel > .rule-field-header {
  width: calc(100% - 126px);
}

.compact-rule-input {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.rule-label {
  display: contents;
  position: relative;
  min-width: 0;
  line-height: 1.2;
}

.rule-info {
  display: inline-grid;
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(145, 163, 181, 0.42);
  border-radius: 50%;
  background: rgba(145, 163, 181, 0.1);
  color: #b9c8d8;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  justify-self: center;
}

.rule-toggle {
  justify-self: end;
}

.rule-info::after {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: 260px;
  padding: 9px 10px;
  transform: translateX(-50%) translateY(4px);
  border: 1px solid rgba(94, 234, 212, 0.22);
  border-radius: 8px;
  background: #07111b;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.34);
  color: var(--ink);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  white-space: normal;
}

.rule-info::before {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  z-index: 21;
  width: 9px;
  height: 9px;
  transform: translateX(-50%) rotate(45deg);
  background: #07111b;
  content: "";
  opacity: 0;
  pointer-events: none;
}

.rule-info:hover,
.rule-info:focus-visible {
  border-color: rgba(94, 234, 212, 0.55);
  color: #5eead4;
  outline: 0;
}

.rule-info:hover::after,
.rule-info:hover::before,
.rule-info:focus-visible::after,
.rule-info:focus-visible::before {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.rule-info:hover::before,
.rule-info:focus-visible::before {
  transform: translateX(-50%) rotate(45deg);
}

input[type="number"],
input[type="time"],
input[type="text"],
input[type="password"],
input[type="url"],
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0b1520;
  color: var(--ink);
  color-scheme: dark;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

input[type="number"]:focus,
input[type="time"]:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
select:focus {
  border-color: rgba(15, 118, 110, 0.65);
  box-shadow:
    0 0 0 3px rgba(15, 118, 110, 0.12),
    inset 0 1px 2px rgba(17, 24, 39, 0.04);
  outline: 0;
}

input:disabled {
  opacity: 0.6;
}

.time-row > label {
  flex: 1;
}

.trading-window-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  min-height: 72px;
  align-items: end;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 21, 32, 0.6);
}

.trading-window-row label {
  margin-bottom: 0;
}

.extra-windows {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.extra-window-row {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  min-height: 72px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 21, 32, 0.6);
}

.extra-window-row label {
  margin-bottom: 0;
}

.add-window-button,
.remove-window-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 800;
}

.add-window-button {
  width: 100%;
  margin: -2px 0 10px;
}

.remove-window-button {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  color: var(--warn);
  font-size: 17px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.add-window-button:hover:not(:disabled),
.remove-window-button:hover:not(:disabled) {
  border-color: rgba(20, 184, 166, 0.52);
  transform: translateY(1px);
}

.add-window-button:disabled,
.remove-window-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.switch-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.rule-toggle {
  display: inline-flex;
  align-items: center;
  margin: 0;
  position: relative;
  min-width: 44px;
  min-height: 24px;
  cursor: pointer;
}

.switch-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.rule-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rule-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  border: 1px solid rgba(74, 222, 128, 0.72);
  border-radius: 999px;
  background: #16a34a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.rule-switch::before {
  content: attr(data-on);
  width: 24px;
  text-align: center;
}

.rule-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
}

.rule-toggle input:not(:checked) + .rule-switch {
  border-color: #556475;
  background: #263443;
  color: #aab7c4;
  box-shadow: none;
}

.rule-toggle input:not(:checked) + .rule-switch::before {
  content: attr(data-off);
}

.rule-toggle input:not(:checked) + .rule-switch::after {
  right: auto;
  left: 3px;
  background: #d7dee6;
}

.rule-toggle input:disabled + .rule-switch {
  opacity: 0.58;
}

.rule-toggle input:disabled {
  cursor: not-allowed;
}

.settings-section {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-broker-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(11, 21, 32, 0.62);
}

.settings-broker-panel h2 {
  margin: 0;
  font-size: 20px;
}

.settings-broker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-form label {
  margin-bottom: 0;
}

.settings-form.settings-locked {
  opacity: 0.82;
}

.settings-form.settings-locked input,
.settings-form.settings-locked select {
  border-color: rgba(248, 113, 113, 0.22);
}

.settings-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.settings-toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(11, 21, 32, 0.64);
  color: var(--ink);
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings-status {
  border-radius: 99px;
  padding: 7px 10px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 850;
}

.settings-status.configured {
  background: var(--good-soft);
  color: var(--good);
}

.fine-print {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.lock-duration-field {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.lock-duration-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.lock-duration-field select {
  min-height: 38px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 850;
}

.lock-actions {
  display: grid;
  gap: 6px;
}

.lock-actions-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  align-items: end;
  gap: 10px;
}

.lock-actions .primary-button {
  width: 104px;
  min-width: 104px;
  min-height: 38px;
  margin-bottom: 14px;
  padding: 0 10px;
  border-color: rgba(45, 212, 191, 0.36);
  border-radius: 8px;
  background: linear-gradient(180deg, #2dd4bf 0%, #0f766e 100%);
  color: #031018;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 2px 0 rgba(0, 0, 0, 0.22);
}

.lock-actions .primary-button:hover:not(:disabled) {
  transform: translateY(1px);
}

.lock-actions .armed-button {
  width: 104px;
  min-width: 104px;
  border-color: rgba(248, 113, 113, 0.46);
  background: rgba(127, 29, 29, 0.3);
  color: var(--warn);
  font-size: 13px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 2px 0 rgba(0, 0, 0, 0.24);
  opacity: 0.88;
}

.lock-description {
  margin-top: 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(11, 21, 32, 0.58);
}

.lock-description strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.lock-description p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.unlock-timer {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 2px;
  color: var(--good);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.rules-panel > .unlock-timer {
  margin-top: 8px;
}

.rules-panel input[type="text"],
.rules-panel input[type="time"],
.rules-panel select {
  min-height: 38px;
  font-size: 13px;
}

.time-input-wrap {
  display: block;
  position: relative;
}

.time-input-wrap input[type="time"] {
  padding-right: 12px;
}

.time-input-icon {
  display: none;
}

.time-input-icon::before,
.time-input-icon::after {
  display: none;
}

.action-controls {
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.setup-note {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  background: #0d1723;
}

.monitor-note {
  border-left-color: var(--blue);
}

.setup-note span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.journal-panel {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1723;
}

.performance-section {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.split-layout > .performance-section {
  display: flex;
  align-self: stretch;
  flex-direction: column;
  margin-top: 0;
  overflow: hidden;
}

.split-layout > .performance-section.view-calendar .calendar-panel {
  flex: 1;
}

.split-layout > .performance-section.view-monthly .calendar-panel,
.split-layout > .performance-section.view-daily .calendar-panel {
  flex: 0 0 auto;
}

.workspace > .performance-section {
  overflow: hidden;
}

.split-layout > .performance-section .section-heading,
.workspace > .performance-section .section-heading {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.split-layout > .performance-section .journal-stats,
.workspace > .performance-section .journal-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.split-layout > .performance-section .metric,
.workspace > .performance-section .metric {
  min-height: 60px;
  padding: 8px 10px;
}

.split-layout > .performance-section .metric strong,
.workspace > .performance-section .metric strong {
  margin: 5px 0 3px;
  font-size: 18px;
}

.split-layout > .performance-section .metric span,
.split-layout > .performance-section .metric small,
.workspace > .performance-section .metric span,
.workspace > .performance-section .metric small {
  font-size: 10px;
}

.split-layout > .performance-section .calendar-toolbar,
.workspace > .performance-section .calendar-toolbar {
  margin-bottom: 6px;
}

.split-layout > .performance-section .calendar-panel,
.workspace > .performance-section .calendar-panel {
  margin-bottom: 0;
}

.split-layout > .performance-section .journal-tabs,
.workspace > .performance-section .journal-tabs {
  gap: 7px;
}

.split-layout > .performance-section .journal-tabs button,
.workspace > .performance-section .journal-tabs button {
  min-width: 86px;
  padding: 7px 12px;
  font-size: 12px;
}

.split-layout > .performance-section .calendar-month,
.workspace > .performance-section .calendar-month {
  margin-top: 10px;
}

.split-layout > .performance-section .calendar-month h3,
.workspace > .performance-section .calendar-month h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.split-layout > .performance-section .calendar-grid,
.split-layout > .performance-section .calendar-weekdays,
.split-layout > .performance-section .calendar-row,
.workspace > .performance-section .calendar-grid,
.workspace > .performance-section .calendar-weekdays,
.workspace > .performance-section .calendar-row {
  gap: 4px;
}

.split-layout > .performance-section .calendar-weekdays span,
.workspace > .performance-section .calendar-weekdays span {
  font-size: 11px;
}

.split-layout > .performance-section .calendar-cell,
.workspace > .performance-section .calendar-cell {
  min-height: 83px;
  border-radius: 6px;
  padding: 8px 9px;
}

.split-layout > .performance-section .calendar-cell > span,
.workspace > .performance-section .calendar-cell > span {
  font-size: 12px;
}

.split-layout > .performance-section .calendar-cell strong,
.workspace > .performance-section .calendar-cell strong {
  font-size: 12px;
  line-height: 1;
}

.split-layout > .performance-section .calendar-cell small,
.workspace > .performance-section .calendar-cell small {
  font-size: 10px;
}

.split-layout > .performance-section.view-calendar .journal-columns,
.workspace > .performance-section.view-calendar .journal-columns {
  display: none;
}

.split-layout > .performance-section.view-monthly .journal-columns,
.split-layout > .performance-section.view-daily .journal-columns,
.workspace > .performance-section.view-monthly .journal-columns,
.workspace > .performance-section.view-daily .journal-columns {
  display: block;
}

.split-layout > .performance-section.view-monthly .journal-panel,
.split-layout > .performance-section.view-daily .journal-panel {
  margin-top: 0;
}

.split-layout > .performance-section.view-monthly .journal-card,
.split-layout > .performance-section.view-daily .journal-card {
  min-height: 54px;
  padding: 9px 10px;
}

.split-layout > .performance-section.view-monthly .journal-card:hover,
.split-layout > .performance-section.view-daily .journal-card:hover {
  transform: none;
}

.split-layout > .performance-section.view-monthly .symbol-mark,
.split-layout > .performance-section.view-daily .symbol-mark {
  width: 44px;
  height: 34px;
}

.split-layout > .performance-section.view-monthly .journal-panel {
  border: 0;
  background: transparent;
}

.split-layout > .performance-section.view-monthly .journal-title {
  display: none;
}

.monthly-journal-card {
  padding: 18px 4px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.monthly-journal-card:last-child {
  border-bottom: 0;
}

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

.monthly-card-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}

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

.monthly-metrics span,
.monthly-metrics strong {
  display: block;
  text-align: center;
}

.monthly-metrics span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
}

.monthly-metrics strong {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 500;
}

.monthly-win-rate {
  color: #f2a365;
}

.monthly-sparkline {
  display: block;
  width: 100%;
  height: 120px;
}

.monthly-sparkline line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2;
}

.monthly-sparkline polyline {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.split-layout > .performance-section.view-daily .journal-panel {
  border: 0;
  background: transparent;
}

.split-layout > .performance-section.view-daily .journal-title {
  display: none;
}

.split-layout > .performance-section.view-monthly #monthlyJournalBody,
.split-layout > .performance-section.view-daily #dailyJournalBody {
  max-height: 390px;
  overflow: hidden;
}

.daily-journal-day {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.daily-date-block {
  padding-top: 4px;
}

.daily-date-block strong,
.daily-date-block span {
  display: block;
}

.daily-date-block strong {
  color: #ffffff;
  font-size: 48px;
  font-weight: 500;
  line-height: 0.92;
}

.daily-date-block span {
  margin-top: 8px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}

.daily-trade-card {
  border: 1px solid #242a3a;
  border-radius: 8px;
  padding: 14px 15px;
  background: #11141d;
}

.daily-stat-grid {
  display: grid;
  grid-template-columns: minmax(54px, 0.8fr) minmax(64px, 1fr) minmax(64px, 0.8fr) minmax(58px, 0.7fr);
  gap: 9px 14px;
  align-items: center;
  margin-bottom: 16px;
}

.daily-stat-grid span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.daily-stat-grid strong {
  color: #ffffff;
  text-align: right;
  font-size: 14px;
  font-weight: 850;
}

.daily-symbol-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.trade-chip {
  min-width: 58px;
  border-radius: 999px;
  padding: 6px 12px;
  color: #071018;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.trade-chip.win {
  background: var(--good);
}

.trade-chip.loss {
  background: #ff7178;
}

.trade-chip.empty {
  width: auto;
  background: #232939;
  color: var(--muted);
}

.workspace > .rules-panel,
.workspace > .monitor-panel {
  margin-top: 16px;
}

.journal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-panel {
  margin-bottom: 16px;
}

.calendar-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.journal-tabs {
  display: inline-flex;
  gap: 10px;
}

.journal-tabs button {
  min-width: 118px;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: #111927;
  color: var(--muted);
  text-align: center;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.journal-tabs button.active {
  background: #30364f;
  color: #ffffff;
}

.journal-tabs button:hover {
  transform: none;
}

.calendar-month {
  margin-top: 24px;
}

.calendar-month:first-child {
  margin-top: 0;
}

.calendar-month h3 {
  margin: 0 0 16px;
  font-size: 26px;
  line-height: 1;
}

.calendar-grid {
  display: grid;
  gap: 6px;
}

.calendar-weekdays,
.calendar-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(82px, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  color: var(--ink);
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

.calendar-cell {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 86px;
  border: 1px solid #22273a;
  border-radius: 8px;
  padding: 10px;
  background: #11141d;
  overflow: hidden;
}

.calendar-cell.empty {
  opacity: 0.45;
}

.calendar-cell.win {
  border-color: rgba(20, 184, 166, 0.4);
  background:
    linear-gradient(180deg, rgba(20, 184, 166, 0.08), rgba(17, 20, 29, 0.98));
}

.calendar-cell.loss {
  border-color: rgba(248, 113, 113, 0.38);
  background:
    linear-gradient(180deg, rgba(248, 113, 113, 0.08), rgba(17, 20, 29, 0.98));
}

.calendar-cell.week {
  background: #0f1420;
}

.calendar-cell > span {
  color: var(--ink);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.calendar-cell div {
  align-self: end;
  text-align: right;
}

.calendar-cell strong,
.calendar-cell small {
  display: block;
}

.calendar-cell strong {
  font-size: 14px;
  line-height: 1.2;
}

.calendar-cell small {
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
}

.journal-columns {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
}

.performance-card .symbol-mark {
  width: 58px;
}

.performance-card .journal-values strong {
  font-size: 18px;
}

.journal-panel:first-of-type {
  margin-top: 0;
}

.journal-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #132131;
}

.journal-title strong,
.journal-title span {
  display: block;
}

.journal-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.journal-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #101b28;
  transition:
    background-color 120ms ease,
    transform 120ms ease;
}

.journal-card:first-child {
  border-top: 0;
}

.journal-card:hover {
  background: #142436;
  transform: translateX(2px);
}

.journal-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.journal-main div,
.journal-values {
  min-width: 0;
}

.journal-main strong,
.journal-main small,
.journal-values strong,
.journal-values small {
  display: block;
}

.journal-main small,
.journal-values small {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journal-values {
  text-align: right;
}

.symbol-mark {
  display: grid;
  width: 48px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.12);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.status-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 82px;
  border-radius: 99px;
  padding: 5px 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.status-badge.filled {
  background: var(--good-soft);
  color: var(--good);
}

.status-badge.rejected,
.status-badge.canceled {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-badge.new,
.status-badge.pendingnew,
.status-badge.accepted,
.status-badge.partiallyfilled {
  background: rgba(96, 165, 250, 0.14);
  color: var(--blue-strong);
}

.journal-empty {
  padding: 18px 14px;
  color: var(--muted);
  background: #101b28;
}

.positive {
  color: var(--good);
}

.negative {
  color: var(--warn);
}

.activity-section {
  margin-top: 14px;
}

.activity-log {
  display: grid;
  gap: 9px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-log li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.activity-log strong {
  color: var(--ink);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .split-layout,
  .journal-columns,
  .calendar-weekdays,
  .calendar-row {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-weekdays {
    display: none;
  }

  .calendar-cell {
    min-height: 72px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-clock {
    justify-items: start;
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar-actions,
  .form-actions {
    width: 100%;
    flex-direction: column;
  }

  .time-row {
    width: 100%;
  }

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

  .trading-window-row,
  .extra-window-row {
    grid-template-columns: 1fr;
  }

  .rules-panel .rule-field {
    grid-template-columns: 1fr;
  }

  .settings-row {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button,
  .danger-button,
  .warning-button,
  .info-button,
  .connect-button,
  .liquidate-button,
  .add-window-button {
    width: 100%;
  }

  .liquidate-button {
    margin-left: 0;
  }

  .journal-card {
    grid-template-columns: 1fr;
  }

  .journal-values {
    text-align: left;
  }
}
