:root {
  --bg-light: #f4f6fb;
  --header-bg: #ffffff;
  --card-bg: #ffffff;
  --border-color: #dbe0ea;
  
  --text-dark: #1e293b;
  --text-muted: #64748b;

  --red-accent: #e11d48;
  --red-light-bg: #fff1f2;
  --red-border: #fca5a5;

  --green-accent: #16a34a;
  --green-light-bg: #f0fdf4;
  --amber-accent: #d97706;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.light-terminal {
  background-color: var(--bg-light);
  color: var(--text-dark);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.4;
  min-height: 100vh;
  overflow-y: auto;
}

.cliq-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: auto;
  padding: 8px 12px;
  gap: 8px;
}

/* Header */
.cliq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.label-bold {
  font-weight: 600;
  color: #475569;
}

.cliq-select {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--font-sans);
  color: var(--text-dark);
  outline: none;
  cursor: pointer;
}

.cliq-select:focus {
  border-color: #94a3b8;
}

.btn-connect-fyers {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 14px;
}

.connection-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
}

.connection-pill.connected {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.connection-pill.expired {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
  animation: pulse-border 2s infinite;
}

.connection-pill.disconnected {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-card {
  background: #ffffff;
  border-radius: 8px;
  width: 420px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.modal-card.modal-wide {
  width: 650px;
}

.chain-table td {
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.chain-table tr.atm-row {
  background: #fef08a !important;
  font-weight: 700;
}

.chain-table tr.atm-row td {
  border-top: 2px solid var(--amber-accent);
  border-bottom: 2px solid var(--amber-accent);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 14px;
  color: #1e293b;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
}

.modal-info {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 14px;
}

.modal-section h4 {
  font-size: 11px;
  color: #475569;
  margin-bottom: 6px;
}

.divider-or {
  text-align: center;
  margin: 12px 0;
  border-bottom: 1px solid #e2e8f0;
  line-height: 0.1em;
}

.divider-or span {
  background: #fff;
  padding: 0 8px;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 700;
}

.cliq-input {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.full-width {
  width: 100%;
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.clock-display {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Controls Panel */
.cliq-controls-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.ctrl-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 85px;
}

.ctrl-field label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.qty-stepper {
  display: flex;
  align-items: center;
}

.step-btn {
  background: var(--red-accent);
  color: white;
  border: none;
  width: 22px;
  height: 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-stepper input {
  width: 55px;
  text-align: center;
  border: 1px solid var(--border-color);
  margin: 0 4px;
  height: 24px;
  font-size: 11px;
  font-weight: 700;
  -moz-appearance: textfield;
}

.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-toggle-btn {
  background: var(--red-accent);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.ctrl-checkbox-input .input-with-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-checkbox-input input[type="number"] {
  width: 55px;
  padding: 3px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 11px;
}

.unit-select {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 3px 4px;
  font-size: 10px;
  background: #f8fafc;
}

.btn-outline-danger {
  background: #ffffff;
  border: 1px solid var(--red-border);
  color: var(--red-accent);
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.one-click-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
}

/* Middle Execution & Chart Section */
.cliq-charts-grid,
.cliq-execution-section {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 12px;
}

.chart-card,
.exec-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.symbol-tag { font-weight: 700; font-size: 13px; }
.expiry-tag { font-size: 10px; color: #64748b; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }
.strike-tag { font-weight: 700; font-size: 13px; }
.opt-type-tag { font-weight: 700; font-size: 11px; }

.text-green { color: var(--green-accent); }
.text-red { color: var(--red-accent); }
.justify-center { justify-content: center; text-align: center; }
.justify-around { justify-content: space-around; }

.card-price-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0;
}

.ltp-huge {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}

.change-banner {
  font-size: 11px;
  font-weight: 600;
}

.card-stats-row {
  display: flex;
  gap: 10px;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-actions,
.spot-panic-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.action-split-btn,
.btn-panic {
  flex: 1;
  padding: 6px 10px;
  font-size: 11px;
}

.strike-stepper {
  display: flex;
  gap: 4px;
}

.bold-title {
  font-size: 14px;
  color: #1e293b;
}

.btn-chain {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

/* Sparkline Chart Container */
.sparkline-container,
.chart-container {
  position: relative;
  height: 90px;
  width: 100%;
  margin: 4px 0;
  overflow: hidden;
}

.spark-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-top-labels {
  position: absolute;
  top: 2px;
  left: 4px;
  right: 65px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
}

.label-open { color: var(--amber-accent); }
.label-high { color: var(--green-accent); }

.chart-bottom-labels {
  position: absolute;
  bottom: 2px;
  left: 4px;
  right: 65px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
}

.ref-price {
  display: none;
}

.label-low { color: var(--red-accent); }

/* Banners */
.price-banner {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  margin-top: 4px;
}

.pe-banner-reverse {
  justify-content: space-between;
}

.ltp-text { font-size: 15px; }
.change-text { font-size: 11px; }

.price-banner.negative .ltp-text strong,
.price-banner.negative .change-text { color: var(--red-accent); }

.price-banner.positive .ltp-text strong,
.price-banner.positive .change-text { color: var(--green-accent); }

/* Split Action Buttons */
.card-actions-split {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.split-btn-group {
  display: flex;
  flex: 1;
}

.split-btn-group .btn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.split-btn-group .caret-btn {
  flex: 0 0 24px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0;
  font-size: 10px;
}

.btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 4px;
  border: none;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

.btn-red-fill {
  background: var(--red-accent);
  color: white;
}

.btn-green-fill {
  background: var(--green-accent);
  color: white;
}

.btn-grey-fill {
  background: #e2e8f0;
  color: #1e293b;
  border: 1px solid #cbd5e1;
}

.spot-title-bar-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.btn-option-chain {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-option-chain:hover {
  background: #dbeafe;
}

/* Center Card Panic Controls */
.center-card {
  align-items: center;
  text-align: center;
  justify-content: space-between;
}

.spot-title-bar {
  font-weight: 700;
  font-size: 14px;
  color: #334155;
}

.spot-price-banner {
  font-family: var(--font-mono);
}

.spot-ltp-text { font-size: 16px; }
.spot-change-text { font-size: 12px; color: var(--green-accent); }

.center-panic-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.btn-outline-red-panic {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--red-accent);
  color: var(--red-accent);
  border-radius: 4px;
  padding: 7px 8px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}

.btn-outline-red-panic:hover {
  background: var(--red-light-bg);
}

.icon-round-btn {
  background: #ffffff;
  border: 1px solid var(--red-accent);
  color: var(--red-accent);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.terminal-msg {
  font-size: 10px;
  color: var(--text-muted);
}

/* Bottom Tabbed Panel */
.cliq-bottom-panel {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--red-accent);
  border-bottom-color: var(--red-accent);
  background: #ffffff;
}

.tab-summary-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 5px 14px;
  background: var(--red-light-bg);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
}

.qty-summary {
  color: var(--red-accent);
  font-weight: 600;
  justify-self: start;
}

.mtm-summary.center-mtm {
  font-weight: 700;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  justify-self: center;
  background: #ffffff;
  padding: 3px 14px;
  border-radius: 14px;
  border: 1px solid #fca5a5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mtm-status-right {
  justify-self: end;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
}

.table-container,
.table-wrapper {
  flex: 1;
  min-height: 220px;
  overflow-y: auto;
}

.cliq-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.cliq-data-table th {
  background: #f1f5f9;
  text-align: left;
  padding: 6px 10px;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.cliq-data-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}

.no-records {
  text-align: center;
  color: var(--text-muted);
  padding: 24px !important;
}

/* SL & Target Steppers in Data Table */
.btn-circle-add {
  background: transparent;
  border: 1.5px solid var(--green-accent);
  color: var(--green-accent);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.btn-circle-add:hover {
  background: var(--green-accent);
  color: white;
}

.sl-tgt-stepper {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.sl-tgt-input {
  width: 58px;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.sl-tgt-input::-webkit-outer-spin-button,
.sl-tgt-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-step-sm {
  background: transparent;
  border: none;
  color: #475569;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-step-sm:hover {
  color: #0f172a;
}

/* Position Table Action Buttons & Partial Exit Dropdown */
.action-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.btn-action-icon {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
}

.btn-grid-menu {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

.btn-grid-menu:hover {
  background: #16a34a;
  color: #ffffff;
}

.btn-exit-close {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fff1f2;
}

.btn-exit-close:hover {
  background: #dc2626;
  color: #ffffff;
}

.action-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 9999;
  min-width: 110px;
  overflow: hidden;
}

.action-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  border: none;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
}

.action-dropdown-item:hover {
  background: #f1f5f9;
  color: #2563eb;
}
