/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial');
  ascent-override:  90.20%;
  descent-override: 22.48%;
  line-gap-override: 0%;
  size-adjust:      107.40%;
}

/* ===== DESIGN TOKENS (same as landing) ===== */
:root {
  --teal:          #0f766e;
  --teal-dark:     #115e59;
  --teal-soft:     rgba(15,118,110,.1);
  --teal-glow:     rgba(15,118,110,.18);
  --blue:          #1d6fe8;
  --orange:        #f59e0b;

  --bg:            #f0f6ff;
  --surface:       #ffffff;
  --surface-2:     #f7faff;
  --surface-glass: rgba(255,255,255,.82);
  --border:        rgba(30,60,120,.1);
  --border-strong: rgba(30,60,120,.18);

  --text:          #0f1c2e;
  --text-2:        #4a5a72;
  --text-3:        #8898aa;

  --radius-xl:     24px;
  --radius-lg:     18px;
  --radius-md:     14px;
  --radius-sm:     10px;

  --shadow:        0 20px 60px rgba(15,40,90,.1);
  --shadow-sm:     0 4px 20px rgba(15,40,90,.07);
  --shadow-panel:  0 8px 28px rgba(15,40,90,.08);
}

/* ===== BASE ===== */
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: var(--bg);
  /* subtle blobs matching landing */
  background-image:
    radial-gradient(circle at 10% 0%,   rgba(29,111,232,.07)  0%, transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(15,118,110,.07)  0%, transparent 40%);
}

/* ===== LAYOUT ===== */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 12px;
  padding: 16px;
}
#app.app-hidden { visibility: hidden; }

/* ===== HEADER ===== */
.hero-header {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.hero-copy { display: flex; flex-direction: column; gap: 6px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--teal-soft);
  border: 1px solid rgba(15,118,110,.2);
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: var(--text);
}

.hero-title-link {
  color: inherit;
  text-decoration: none;
  transition: opacity .18s;
}
.hero-title-link:hover { opacity: .65; }

.hero-subtitle {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  max-width: 420px;
}

/* ===== TOOLBAR PANEL ===== */
.auth-row {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.toolbar-panel {
  display: flex;
  align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: visible;
  flex-wrap: wrap;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
}

.toolbar-section-status {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 120px;
}

.toolbar-section-lang { gap: 8px; }
.toolbar-section-btns { gap: 6px; }

.toolbar-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
  margin: 8px 0;
}

.status-label {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.auth-status {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

/* language select inside toolbar */
.toolbar-section-lang label {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ===== TOOLBAR BUTTONS ===== */
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
  white-space: nowrap;
  list-style: none;
}
.toolbar-btn:hover {
  background: var(--surface);
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--teal-glow);
}
.toolbar-btn svg { flex-shrink: 0; opacity: .6; }
.toolbar-btn:hover svg { opacity: 1; }
.menu summary.toolbar-btn { list-style: none; }
.menu summary.toolbar-btn::-webkit-details-marker { display: none; }

/* ===== GENERIC INPUTS & SELECTS ===== */
input[type="text"],
input[type="number"],
select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

/* ===== GENERIC BUTTONS ===== */
button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
  white-space: nowrap;
}
button:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--teal-glow);
}
button.primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}
button.primary:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
  box-shadow: 0 6px 18px var(--teal-glow);
}
button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== SURFACE CARDS (toolbar rows) ===== */
.surface-card {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.top-row,
.controls-row,
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
}
.file-group input[type="text"] {
  flex: 1;
  min-width: 140px;
}

.controls-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.controls-row input[type="number"] { width: 80px; }

.label-pair {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
}
.label {
  font-weight: 700;
  color: var(--text-2);
}

.slider-row { gap: 12px; }
#timeline {
  flex: 1;
  accent-color: var(--teal);
  height: 4px;
}
#rangeLabel {
  min-width: 130px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}

/* ===== ACCOUNT DROPDOWN ===== */
.menu {
  position: relative;
  z-index: 3000;
}
.menu summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
}
.menu summary::-webkit-details-marker { display: none; }

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: min(320px, calc(100vw - 32px));
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 3100;
  box-shadow: var(--shadow);
  max-height: min(440px, calc(100vh - 48px));
  overflow-y: auto;
}
details.menu[open] .menu-panel { display: flex; }

.menu-item {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  padding: 2px 4px;
}
.menu-action {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

.gsi-signin-wrap { padding: 4px 0; }
.gsi-signin-wrap > div {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  overflow: hidden;
}

.turnstile-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}
.turnstile-status { font-size: 12px; line-height: 1.5; color: var(--text-2); }
.turnstile-container { min-height: 65px; width: 100%; overflow: hidden; }

/* ===== BANNERS ===== */
.access-banner {
  background: rgba(255,248,220,.9);
  border: 1px solid rgba(236,197,104,.6);
  color: #7a5a00;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

/* ===== ADMIN PANEL ===== */
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}
.admin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-row input[type="text"] { min-width: 200px; }
.admin-output {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  max-height: 160px;
  overflow: auto;
  font-size: 12px;
  font-family: 'Consolas', monospace;
}

/* ===== MAIN GRID ===== */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 38%) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}
.left-panel {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

/* ===== PANELS ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.gantt-panel { overflow-y: auto; overflow-x: hidden; }

.panel-title {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
}

#ganttCanvas, #costsCanvas {
  width: 100%;
  height: 100%;
  flex: 1;
}
#ganttCanvas { flex: none; }

.right-panel { min-height: 0; }

#viewer {
  flex: 1;
  min-height: 460px;
  background: linear-gradient(160deg, #e8f0fb 0%, #f0f6ff 100%);
}

/* ===== WARNING ===== */
.warning {
  background: rgba(255,248,220,.92);
  color: #5a3d00;
  border: 1px solid rgba(240,195,109,.7);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin: 16px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.warning-detail {
  margin-top: 6px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: #7a1c00;
  white-space: pre-wrap;
}

.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .hero-header { flex-direction: column; align-items: flex-start; }
  .auth-row { margin-left: 0; width: 100%; }
}

@media (max-width: 980px) {
  #app { padding: 12px; }
  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 1fr) minmax(320px, 1fr);
  }
  .left-panel {
    grid-template-rows: minmax(240px, 1fr) minmax(240px, 1fr);
  }
}

@media (max-width: 680px) {
  .hero-header, .surface-card, .admin-panel { padding: 12px; }
  .top-row, .controls-row { width: 100%; }
  .file-group { flex: 1 1 100%; }
  .menu-panel { left: 0; right: auto; width: min(100%, calc(100vw - 24px)); }
  .label-pair { flex: 1 1 45%; justify-content: space-between; }
  .toolbar-panel { width: 100%; }
}
