/* ============================================================
   ANTARESTAR · Product Development Dashboard
   Brand: orange (#F26A21) + navy/blue. Clean, technical, layered.
   Driver-coded semantic color. Light surfaces.
   ============================================================ */

:root {
  /* — Brand — */
  --orange:      #F26A21;
  --orange-2:    #FF7E33;
  --orange-soft: #FCE7D9;
  --navy:        #15333F;
  --navy-2:      #1E4A5A;
  --navy-soft:   #DCE6EA;
  --blue:        #2C7DA6;
  --blue-2:      #3A93BE;
  --blue-soft:   #E0EDF3;

  /* — Surfaces (cool light) — */
  --canvas:      #EBEFF2;
  --canvas-2:    #DFE6EA;
  --surface:     #F8FAFB;
  --surface-raise:#FFFFFF;
  --line:        #D7DFE3;
  --line-soft:   #E5EAEE;

  /* — Ink — */
  --ink:         #16262D;
  --ink-2:       #45565E;
  --ink-3:       #7A8a92;
  --ink-inv:     #EEF4F6;

  /* — Driver semantics — */
  --traffic:      #F26A21;
  --traffic-soft: #FCE7D9;
  --gmv:          #2C7DA6;
  --gmv-soft:     #DEEBF3;
  --profit:       #2E9E6B;
  --profit-soft:  #DBF0E5;

  /* — Health — */
  --ok:    #2E9E6B;
  --warn:  #E0922E;
  --stuck: #D1492E;
  --ok-soft:    #DBF0E5;
  --warn-soft:  #F8E8CF;
  --stuck-soft: #F6DED7;

  /* — Type — */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Inter', ui-sans-serif, system-ui, sans-serif;
  --text-xs:   0.72rem;
  --text-sm:   0.82rem;
  --text-base: 0.94rem;
  --text-lg:   1.15rem;
  --text-xl:   1.5rem;
  --text-num:  clamp(1.8rem, 1.3rem + 1.6vw, 2.6rem);

  /* — Shape / motion — */
  --r-sm: 8px;
  --r:    14px;
  --r-lg: 20px;
  --sh-1: 0 1px 2px rgba(21,51,63,.06), 0 1px 1px rgba(21,51,63,.04);
  --sh-2: 0 6px 18px -8px rgba(21,51,63,.20), 0 2px 6px -2px rgba(21,51,63,.10);
  --sh-3: 0 18px 40px -16px rgba(21,51,63,.32);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur:  240ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  background-color: var(--canvas);
  background-image:
    radial-gradient(900px 600px at 100% -5%, rgba(242,106,33,.07), transparent 60%),
    radial-gradient(700px 500px at -5% 100%, rgba(44,125,166,.06), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%2315333F' stroke-opacity='0.045' stroke-width='1'%3E%3Cpath d='M-20 60 Q 60 10 140 60 T 300 60'/%3E%3Cpath d='M-20 100 Q 60 50 140 100 T 300 100'/%3E%3Cpath d='M-20 140 Q 60 90 140 140 T 300 140'/%3E%3Cpath d='M-20 180 Q 60 130 140 180 T 300 180'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}

/* ============================================================ shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy), #102a34);
  color: var(--ink-inv);
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--font-display); font-weight: 700; letter-spacing: .18em; font-size: .82rem; color: #fff; }
.brand-sub { font-size: .68rem; color: rgba(238,244,246,.55); letter-spacing: .06em; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; background: transparent; border: none; border-radius: 10px;
  color: rgba(238,244,246,.74); font-family: var(--font-body); font-size: var(--text-sm);
  font-weight: 500; text-align: left; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav-item .nav-ico { font-size: 1rem; width: 18px; text-align: center; opacity: .85; }
.nav-item:hover { background: rgba(238,244,246,.07); color: #fff; transform: translateX(2px); }
.nav-item.is-active {
  background: linear-gradient(100deg, rgba(242,106,33,.22), rgba(238,244,246,.05));
  color: #fff; box-shadow: inset 3px 0 0 var(--orange);
}

.nav-foot { margin-top: auto; padding: 14px; background: rgba(0,0,0,.18); border-radius: 12px; }
.legend-title { font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; color: rgba(238,244,246,.5); margin-bottom: 10px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: var(--text-sm); color: rgba(238,244,246,.85); padding: 3px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================ main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 20px 30px;
  border-bottom: 1px solid var(--line); background: rgba(248,250,251,.72);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20;
}
.menu-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--ink); }
.topbar-titles { flex: 1; }
.view-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; letter-spacing: -.01em; }
.view-sub { font-size: var(--text-sm); color: var(--ink-3); margin-top: 2px; }
.meta-chip { font-family: var(--font-display); font-size: var(--text-sm); font-weight: 500; padding: 7px 14px; background: var(--surface-raise); border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); }

.view { padding: 30px; max-width: 1500px; }
.loading { padding: 60px; text-align: center; color: var(--ink-3); }
.view-enter { animation: rise var(--dur) var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================ primitives */
.card { background: var(--surface-raise); border: 1px solid var(--line-soft); border-radius: var(--r); box-shadow: var(--sh-1); }
.card-pad { padding: 20px 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; gap: 12px; }
.section-head h2 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; }
.section-head .hint { font-size: var(--text-sm); color: var(--ink-3); }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.chip .dot { width: 7px; height: 7px; }
.chip--traffic { background: var(--traffic-soft); color: #b4541a; }
.chip--gmv     { background: var(--gmv-soft);     color: #205e7e; }
.chip--profit  { background: var(--profit-soft);  color: #1e7a52; }
.tag { font-size: var(--text-xs); color: var(--ink-3); font-weight: 500; }

/* buttons */
.btn { font-family: var(--font-body); font-size: var(--text-sm); font-weight: 600; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn--primary { background: var(--orange); color: #fff; box-shadow: 0 4px 12px -4px rgba(242,106,33,.5); }
.btn--primary:hover { background: var(--orange-2); }
.btn--ghost { background: var(--surface-raise); color: var(--ink-2); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-3); }
.btn--danger { background: var(--stuck-soft); color: #a2331f; }
.btn--danger:hover { background: #f1cdc3; }
.btn--add { display: inline-flex; align-items: center; gap: 7px; background: var(--navy); color: #fff; padding: 8px 14px; font-size: var(--text-sm); }
.btn--add:hover { background: var(--navy-2); }
.btn--add .plus { font-size: 1.05rem; line-height: 1; margin-top: -1px; }

/* ============================================================ overview bento */
.bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .kpi-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 600; }
.kpi .kpi-num { font-family: var(--font-display); font-size: var(--text-num); font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.kpi .kpi-foot { font-size: var(--text-sm); color: var(--ink-2); }
.kpi .kpi-accent { position: absolute; right: -8px; bottom: -16px; font-size: 4.4rem; opacity: .07; }
.kpi--hero { background: linear-gradient(155deg, var(--navy), #0f2832); color: var(--ink-inv); border: none; }
.kpi--hero .kpi-label { color: rgba(238,244,246,.7); }
.kpi--hero .kpi-foot { color: rgba(238,244,246,.8); }
.kpi--hero .kpi-num { color: #fff; }
.kpi--hero .kpi-accent { color: var(--orange); opacity: .5; }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }

.balance-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; }
.balance-row + .balance-row { border-top: 1px dashed var(--line-soft); }
.balance-cat { width: 72px; font-weight: 600; font-size: var(--text-sm); }
.balance-track { flex: 1; display: flex; height: 26px; border-radius: 7px; overflow: hidden; background: var(--canvas-2); }
.balance-seg { display: grid; place-items: center; color: #fff; font-size: var(--text-xs); font-weight: 600; min-width: 0; transition: flex var(--dur) var(--ease); }

.launch-list { display: flex; flex-direction: column; }
.launch-item { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line-soft); }
.launch-item:first-child { border-top: none; }
.launch-date { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); width: 64px; flex-shrink: 0; color: var(--blue); }
.launch-name { flex: 1; font-weight: 600; font-size: var(--text-sm); }
.launch-name small { display: block; color: var(--ink-3); font-weight: 400; }

.alert-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.alert-item:first-child { border-top: none; }
.alert-bullet { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.alert-text { flex: 1; font-size: var(--text-sm); }
.alert-days { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); }

/* ============================================================ portfolio matrix */
.matrix { display: grid; grid-template-columns: 96px repeat(3, 1fr); gap: 12px; }
.matrix-head { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; border-radius: var(--r-sm); color: #fff; font-weight: 600; }
.matrix-head small { font-weight: 400; font-size: var(--text-xs); opacity: .88; }
.matrix-corner { display: grid; place-items: center; font-size: var(--text-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; text-align: center; }
.matrix-rowlabel { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); background: var(--surface-raise); border: 1px solid var(--line-soft); border-radius: var(--r-sm); writing-mode: vertical-rl; text-orientation: mixed; letter-spacing: .08em; }
.cell { background: var(--surface-raise); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 116px; cursor: pointer; transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.cell:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.cell .cell-sub { font-weight: 600; font-size: var(--text-sm); }
.cell .cell-price { font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; }
.cell .cell-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.cell-count { font-size: var(--text-xs); color: var(--ink-3); }
.cell-edit { opacity: 0; font-size: var(--text-xs); color: var(--blue); font-weight: 600; transition: opacity var(--dur) var(--ease); }
.cell:hover .cell-edit { opacity: 1; }
.cell--gap { border-style: dashed; border-color: var(--ink-3); background: var(--surface); align-items: flex-start; justify-content: center; }
.cell--gap .cell-sub { color: var(--ink-3); }

.driver-key { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px; }
.driver-key .dk { display: flex; gap: 10px; align-items: flex-start; max-width: 290px; }
.driver-key .dk .dk-bar { width: 4px; align-self: stretch; border-radius: 3px; }
.driver-key .dk h4 { font-family: var(--font-display); font-size: var(--text-sm); }
.driver-key .dk p { font-size: var(--text-xs); color: var(--ink-2); margin-top: 2px; }
.driver-key .dk .dk-kpi { font-size: var(--text-xs); color: var(--ink-3); margin-top: 4px; }

/* ============================================================ pipeline kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 232px; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.kcol { display: flex; flex-direction: column; gap: 10px; }
.kcol-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--canvas-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.kcol-head .kc-name { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); }
.kcol-head .kc-count { font-size: var(--text-xs); color: var(--ink-3); background: var(--surface-raise); border-radius: 999px; padding: 2px 8px; }
.kcol-body { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.pcard { background: var(--surface-raise); border: 1px solid var(--line-soft); border-left: 4px solid var(--ink-3); border-radius: var(--r-sm); padding: 12px 13px; box-shadow: var(--sh-1); cursor: pointer; transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.pcard:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.pcard .pc-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 8px; }
.pcard .pc-name { font-weight: 600; font-size: var(--text-sm); line-height: 1.25; }
.pcard .pc-id { font-family: var(--font-display); font-size: .66rem; color: var(--ink-3); letter-spacing: .03em; }
.pcard .pc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.pcard .pc-days { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600; font-size: var(--text-xs); padding: 3px 9px; border-radius: 999px; }
.pc-days--ok { background: var(--ok-soft); color: #1e7a52; }
.pc-days--warn { background: var(--warn-soft); color: #9a611c; }
.pc-days--stuck { background: var(--stuck-soft); color: #a2331f; }
.pcard .pc-cat { font-size: var(--text-xs); color: var(--ink-3); }
.empty-col { font-size: var(--text-xs); color: var(--ink-3); text-align: center; padding: 16px 0; opacity: .6; }

/* ============================================================ timeline gantt */
.gantt { overflow-x: auto; }
.gantt-inner { min-width: 820px; }
.gantt-row { display: grid; grid-template-columns: 230px 1fr; align-items: center; height: 50px; border-bottom: 1px solid var(--line-soft); }
.gantt-row:not(.gantt-headrow) { cursor: pointer; }
.gantt-row:not(.gantt-headrow):hover { background: rgba(44,125,166,.045); }
.grow-label { padding-right: 14px; overflow: hidden; }
.grow-name { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow-sub { font-size: var(--text-xs); color: var(--ink-3); }
.gtrack { position: relative; height: 100%; }
.gtrack .gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-soft); }
.gmonth { font-family: var(--font-display); font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.gbar { position: absolute; top: 50%; transform: translateY(-50%); height: 9px; border-radius: 999px; opacity: .9; }
.gmile { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--surface-raise); box-shadow: var(--sh-1); }
.gmile--launch { width: 0; height: 0; border-radius: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 13px solid var(--orange); transform: translate(-50%, -60%); box-shadow: none; }
.gtoday { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--stuck); opacity: .6; z-index: 3; }
.gtoday.is-head { opacity: 1; }
.gtoday.is-head::after { content: 'today'; position: absolute; top: -2px; left: 50%; transform: translateX(-50%); font-size: .6rem; color: var(--stuck); font-weight: 700; letter-spacing: .05em; background: var(--canvas); padding: 0 3px; }
.gantt-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; font-size: var(--text-xs); color: var(--ink-2); }
.gantt-legend .gl { display: flex; align-items: center; gap: 7px; }
.gl-mile { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: var(--sh-1); }
.gl-tri { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--orange); }

/* ============================================================ modal + forms */
.modal-overlay { position: fixed; inset: 0; background: rgba(21,38,45,.5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade var(--dur) var(--ease) both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(640px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface-raise); border-radius: var(--r-lg); box-shadow: var(--sh-3); animation: rise var(--dur) var(--ease) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; }
.modal-x { background: none; border: none; font-size: 1.5rem; line-height: 1; color: var(--ink-3); cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line-soft); }
.modal-foot .foot-right { display: flex; gap: 10px; margin-left: auto; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field input, .field select { font-family: var(--font-body); font-size: var(--text-sm); padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%; }
.field input:focus, .field select:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.stage-block { border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 12px 14px; background: var(--surface); }
.stage-title { font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.stage-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 5px 0; }
.stage-row + .stage-row { border-top: 1px dashed var(--line-soft); }
.stage-name { font-size: var(--text-sm); font-weight: 500; }
.stage-row .mini { display: flex; flex-direction: column; gap: 3px; font-size: .64rem; color: var(--ink-3); }
.stage-row .mini input { padding: 6px 8px; font-size: var(--text-xs); border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raise); }

/* ============================================================ responsive */
@media (max-width: 1080px) { .bento { grid-template-columns: repeat(2, 1fr); } .span-4 { grid-column: span 2; } .span-2 { grid-column: span 2; } }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform var(--dur) var(--ease); }
  .sidebar.open { transform: none; box-shadow: var(--sh-3); }
  .menu-toggle { display: block; }
  .view { padding: 18px; } .topbar { padding: 16px 18px; }
  .bento { grid-template-columns: 1fr; } .span-4, .span-2 { grid-column: span 1; }
  .matrix { grid-template-columns: 1fr; }
  .matrix-rowlabel { writing-mode: horizontal-tb; padding: 8px; }
  .matrix-corner { display: none; }
  .stage-row { grid-template-columns: 1fr; }
}
