:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Domine', Georgia, serif;
  --font-mono: 'Kode Mono', monospace;

  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --sidebar-border: #1e293b;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #94a3b8;

  --canvas-bg: #f1f5f9;
  --canvas-dot: #cbd5e1;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-sub: #334155;
  --text-muted: #64748b;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --brand-red: #e11d48;
  --emerald: #059669;
  --amber: #d97706;
}

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

html, body.workspace-body {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--canvas-bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

/* ==========================================================================
   PRELINE CANVAS WORKSPACE SHELL
   ========================================================================== */
.workspace-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Left Sidebar */
.ws-sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s ease;
  z-index: 30;
}

.ws-sidebar.collapsed {
  margin-left: -300px;
}

.ws-sidebar-header {
  padding: 16px 18px;
  border-bottom: 1px solid #1e293b;
}

.ws-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.35);
}

.ws-brand-text {
  display: flex;
  flex-direction: column;
}

.ws-brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: #fff;
}

.ws-brand-sub {
  font-size: 11.5px;
  color: var(--sidebar-muted);
}

/* Search & Filter */
.ws-sidebar-search {
  padding: 12px 14px;
  border-bottom: 1px solid #1e293b;
}

.search-box {
  position: relative;
  margin-bottom: 10px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #64748b;
}

.search-box input {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 8px 10px 8px 32px;
  border-radius: 8px;
  font-size: 12.5px;
  outline: none;
}

.search-box input:focus {
  border-color: #6366f1;
}

.filter-pills {
  display: flex;
  gap: 6px;
}

.filter-pill {
  flex: 1;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill.active, .filter-pill:hover {
  background: #312e81;
  border-color: #6366f1;
  color: #fff;
}

/* Sidebar Companies List */
.ws-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-sidebar-list::-webkit-scrollbar {
  width: 5px;
}
.ws-sidebar-list::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

.accountant-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 10px 8px 4px;
}

.company-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.14s ease;
}

.company-item:hover {
  background: var(--sidebar-hover);
}

.company-item.active {
  background: rgba(79, 70, 229, 0.22);
  border-color: #6366f1;
}

.company-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.company-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
}

.conn-badges {
  display: flex;
  gap: 4px;
}

.conn-pill {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 5px;
  border-radius: 4px;
}

.conn-pill.ok-1c {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.conn-pill.ok-kls {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.conn-pill.ok-pfx {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.conn-pill.no-1c {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.conn-pill.no-pfx {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Sidebar Footer */
.ws-sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.ws-footer-btn:hover {
  background: #334155;
  color: #fff;
}

.ws-footer-btn svg {
  width: 15px;
  height: 15px;
  color: #818cf8;
}

/* ==========================================================================
   MAIN WORKSPACE AREA & TOPBAR
   ========================================================================== */
.ws-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.ws-topbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
}

.ws-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-muted);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.ws-active-company h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-company-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.meta-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.status-dot-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
}

.status-dot-badge.err {
  color: #e11d48;
}

.status-dot-badge.err::before {
  background: #e11d48;
}

.ws-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.period-selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.period-selector-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.ws-select {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.ws-btn svg {
  width: 15px;
  height: 15px;
}

.ws-btn-outline {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text-sub);
}
.ws-btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.ws-btn-secondary {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: var(--primary);
}
.ws-btn-secondary:hover {
  background: #e0e7ff;
}

.ws-btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}
.ws-btn-primary:hover {
  background: var(--primary-hover);
}

/* Slide Jump Rail */
.slide-rail {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 7px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  z-index: 15;
}

.rail-pill {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.14s;
}

.rail-pill:hover {
  background: #eef2ff;
  color: var(--primary);
}

.rail-pill.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #fff;
}

/* ==========================================================================
   PRELINE DOT-GRID CANVAS VIEWPORT & GAMMA PRESENTATION CARDS
   ========================================================================== */
.ws-canvas-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 60px;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(var(--canvas-dot) 1.25px, transparent 1.25px);
  background-size: 20px 20px;
  position: relative;
}

.gamma-deck {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.gamma-slide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 28px -6px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  position: relative;
  padding: 32px 36px;
}

.gamma-slide::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
}

.gamma-slide.slide-cover {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  color: #fff;
  padding: 46px 44px;
}

.gamma-slide.slide-cover::before {
  background: linear-gradient(90deg, #e11d48, #f59e0b);
  height: 6px;
}

.slide-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.slide-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 5px;
  background: #eef2ff;
  color: var(--primary);
  margin-bottom: 6px;
}

.slide-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.slide-meta-right {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
}

.slide-meta-right strong {
  display: block;
  color: var(--text-main);
  font-size: 13px;
}

/* Gamma KPI Grid */
.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.gamma-kpi-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 11px;
  padding: 15px 16px;
}

.gamma-kpi-card.emerald { border-left-color: var(--emerald); }
.gamma-kpi-card.rose { border-left-color: var(--brand-red); }
.gamma-kpi-card.amber { border-left-color: var(--amber); }

.slide-cover .gamma-kpi-card {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  border-left: 4px solid #38bdf8;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.slide-cover .kpi-label {
  color: #94a3b8;
}

.kpi-val {
  font-family: var(--font-mono);
  font-size: 18.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.slide-cover .kpi-val {
  color: #ffffff;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

.slide-cover .kpi-sub {
  color: #cbd5e1;
}

/* Gamma Financial Tables */
.gamma-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.gamma-table-title {
  background: #f8fafc;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

table.gamma-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.gamma-table th {
  background: #0f172a;
  color: #fff;
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

table.gamma-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-sub);
}

table.gamma-table tr:nth-child(even) td {
  background: #f8fafc;
}

table.gamma-table td.num, table.gamma-table th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}

.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.status-tag.green { background: #dcfce7; color: #166534; }
.status-tag.red { background: #fee2e2; color: #991b1b; }
.status-tag.blue { background: #dbeafe; color: #1e40af; }

/* Editable inputs on Slide 11 & 12 */
.editable-input, .editable-textarea {
  width: 100%;
  border: 1px dashed #cbd5e1;
  background: #fffbeb;
  padding: 6px 8px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-main);
}

.editable-textarea {
  min-height: 68px;
  resize: vertical;
}

.editable-input:focus, .editable-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

/* ==========================================================================
   FULLSCREEN PRESENTATION (ZASHITA) MODE
   ========================================================================== */
body.fullscreen-presenter .ws-sidebar,
body.fullscreen-presenter .ws-topbar,
body.fullscreen-presenter .slide-rail {
  display: none !important;
}

body.fullscreen-presenter .ws-canvas-viewport {
  background: #0f172a;
  padding: 24px 40px 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.fullscreen-presenter .gamma-deck {
  width: 100%;
  max-width: 1280px;
}

body.fullscreen-presenter .gamma-slide {
  display: none;
  min-height: calc(100vh - 110px);
}

body.fullscreen-presenter .gamma-slide.active-presenter-slide {
  display: block;
}

.presenter-hud {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid #334155;
  padding: 8px 14px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.hud-btn {
  background: #1e293b;
  border: 1px solid #475569;
  color: #fff;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.hud-btn:hover { background: #334155; }
.hud-btn.hud-exit { background: #be123c; border-color: #e11d48; }
.hud-counter { color: #e2e8f0; font-size: 13px; font-weight: 700; }

/* ==========================================================================
   MODALS, LOADER & TOAST
   ========================================================================== */
.ws-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
}

.ws-modal {
  background: #fff;
  width: 94%;
  max-width: 660px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.ws-modal-header {
  padding: 18px 22px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ws-modal-header h2 {
  font-size: 16.5px;
  font-weight: 700;
}
.ws-modal-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ws-modal-tabs {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.modal-tab {
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.modal-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #fff;
}

.ws-modal-body {
  padding: 20px 22px;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.info-banner {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e1b4b;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group.full {
  grid-column: span 2;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.ws-input {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13px;
}

.modal-action-row {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.modal-status-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
}
.modal-status-msg.ok { background: #dcfce7; color: #166534; }
.modal-status-msg.err { background: #fee2e2; color: #991b1b; }

.ws-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.84);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.ws-loader-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 34px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.1);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3.5px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ws-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: #0f172a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
  z-index: 120;
}
