/* ==========================================================================
   FLEXO DESIGN TOKENS: one light theme, one contract.

   EN: Every value a Flexo surface may use. Authored here by hand since the
       master moved into this repository (10 Nov 2026); flexo.md states each
       rule and this file holds its value. Load it once at the root of the
       app, before any other Flexo sheet.
   VN: Mọi giá trị mà một bề mặt Flexo được dùng. Viết tay tại đây từ khi bản
       gốc chuyển vào kho này (10/11/2026); flexo.md nêu quy tắc, tệp này giữ
       giá trị. Tải một lần ở gốc ứng dụng, trước mọi bảng kiểu Flexo khác.

   EN: Flexo is light only: one theme, no data-theme (Chris, 19 Nov 2026). A product
       that needs a dark mode designs it for itself; it is not part of Flexo.
   VN: Flexo chỉ có chế độ sáng: một giao diện, không có data-theme (Chris, 19/11/2026).
       Sản phẩm cần chế độ tối thì tự thiết kế cho mình; nó không thuộc về Flexo.

   EN: Rule: product code writes var(--role), never a hex. The five literal
       exceptions are listed at the foot of this file.
   VN: Quy tắc: mã sản phẩm viết var(--role), không bao giờ viết mã hex. Năm
       ngoại lệ dạng giá trị thô được liệt kê ở cuối tệp.
   ========================================================================== */

:root {
  /* ---- Neutral ramp: thirteen steps, the only greys that exist ---------- */
  --n-000:  #ffffff;
  --n-025:  #fafafa;
  --n-050:  #f5f5f5;
  --n-100:  #ebebeb;
  --n-200:  #dcdcdc;
  --n-300:  #c4c4c4;
  --n-400:  #9e9e9e;
  --n-500:  #757575;
  --n-600:  #545454;
  --n-700:  #383838;
  --n-800:  #232323;
  --n-900:  #141414;
  --n-1000: #000000;

  /* ---- Surfaces --------------------------------------------------------- */
  --desk:   #232323;   /* EN: the surround of the product frame. VN: nền bao quanh khung sản phẩm. */
  --app:    #ffffff;   /* EN: the frame's own base. VN: nền của chính khung. */
  --field:  #fafafa;   /* EN: the working plane, and the ground of every title bar but a card's. VN: mặt làm việc, và nền của mọi thanh tiêu đề trừ thanh của thẻ. */
  --cell:   #f5f5f5;   /* EN: an icon cell, one ramp step past --field. VN: ô biểu tượng, hơn --field một bậc. */
  --card:   #ffffff;   /* EN: card, popover, dialog. VN: thẻ, bảng nổi, hộp thoại. */

  /* ---- Lines: three weights, never a fourth ----------------------------- */
  --hairline: #f5f5f5; /* EN: between rows. VN: giữa các hàng. */
  --rule:     #ebebeb; /* EN: bars, bands, dividers inside a card. VN: thanh, dải, vạch chia trong thẻ. */
  --border:   #dcdcdc; /* EN: a card's edge, inputs, containers. VN: viền thẻ, ô nhập, vật chứa. */
  --track:    #f5f5f5; /* EN: a bar's empty track, an inert fill. VN: rãnh trống của thanh, nền vô hiệu. */

  /* ---- Ink: text is a SOLID neutral, never an opacity (§2.3) ------------ */
  --ink:       #141414; /* EN: primary text, filled tiles, primary buttons. VN: chữ chính, ô tô đầy, nút chính. */
  --on-ink:    #ffffff; /* EN: anything sitting on --ink. VN: mọi thứ nằm trên --ink. */
  --ink-soft:  #545454; /* EN: secondary values, descriptions, meta columns, a field's label and glyph (neutral-600). VN: giá trị phụ, mô tả, cột phụ, nhãn và glyph của trường (neutral-600). */
  --ink-mid:   #757575; /* EN: a figure's separators, a tab at rest, a placeholder (neutral-500). VN: dấu phân cách của con số, tab ở trạng thái nghỉ, chữ giữ chỗ (neutral-500). */
  --ink-faint: #9e9e9e; /* EN: machine labelling, empty values, a glyph at rest (neutral-400). VN: nhãn máy, giá trị trống, glyph khi nghỉ (neutral-400). */
  --ink-ghost: #c4c4c4; /* EN: an inert verb, a comparison series (neutral-300). VN: động từ vô hiệu, chuỗi so sánh (neutral-300). */

  /* ---- Identity tile: a monogram square, never a button ----------------- */
  --tile:           #141414;
  --tile-ink:       #ffffff;
  --tile-knockout:  #ffffff; /* EN: the colour a knocked-out glyph shows; a tinted row resets it. VN: màu mà glyph khoét lộ ra; hàng được phủ sắc đặt lại nó. */

  /* ---- Brand and status ------------------------------------------------- */
  --brand:   #1b3aff; /* EN: the corporate blue. Never changes with the theme. VN: màu xanh công ty. Không bao giờ đổi theo giao diện. */
  --signal:  #1b3aff; /* EN: the interface accent: links, focus, advancing verbs. VN: màu nhấn giao diện: liên kết, tiêu điểm, động từ tiến. */
  --credit:  #009e4c; /* EN: money in, settled, yes. VN: tiền vào, đã tất toán, có. */
  --debit:   #e62200; /* EN: money out, failed, no. VN: tiền ra, thất bại, không. */
  --pending: #f59e0b; /* EN: the amber: in flight, held, waiting. VN: màu hổ phách: đang xử lý, đang giữ, đang chờ. */
  --info:    #757575; /* EN: not happened yet: draft, staged, cancelled. VN: chưa xảy ra: nháp, chờ duyệt, đã hủy. */

  /* ---- Status washes: one status is one hue; only the wash is lighter --- */
  --credit-wash:  rgba(0,158,76,0.1);
  --pending-wash: rgba(245,158,11,0.14);
  --debit-wash:   rgba(230,34,0,0.1);
  --info-wash:    rgba(117,117,117,0.12);
  --off-wash:     rgba(20,20,20,0.08);  /* EN: the fifth status, "off", is ink. VN: trạng thái thứ năm, "tắt", là màu mực. */
  /* EN: Aliases kept so older markup resolves. Same value as the plain token, always.
     VN: Bí danh giữ lại để mã cũ vẫn chạy. Luôn cùng giá trị với token gốc. */
  --credit-ink:   var(--credit);
  --pending-ink:  var(--pending);
  --debit-ink:    var(--debit);
  --info-ink:     var(--info);

  /* ---- A changed value: the amber at half its status wash (C79) -------- */
  /* EN: Not a status: a row whose value a request would change. Lighter than --pending-wash so a status block on the row
         still reads as its own (Chris, 20 Nov 2026: "the lighter wash, which is 7%").
     VN: Không phải trạng thái: hàng có giá trị mà một yêu cầu sẽ thay đổi. Nhạt hơn --pending-wash để khối trạng thái trên
         hàng vẫn đọc ra là của riêng nó (Chris, 20/11/2026: "lớp phủ nhạt hơn, 7%"). */
  --change-wash: rgba(245,158,11,0.07);

  /* ---- Interaction feedback: one tint, never grey, never a lift --------- */
  --tint:       #eef1ff;
  --tint-press: #e4e9ff;
  --tint-ink:   #141414;

  /* ---- Drawer ----------------------------------------------------------- */
  --drawer-w:        500px;     /* EN: one width for every drawer (Chris, 11 Sep 2026; 500px since 17 Nov 2026). VN: một chiều rộng cho mọi ngăn kéo (Chris, 11/9/2026; 500px từ 17/11/2026). */
  /* EN: A drawer redeclares the surface ramp on its root so its whole subtree steps with it.
     VN: Ngăn kéo khai báo lại thang bề mặt trên gốc của nó để cả cây con cùng đổi bậc. */
  --drawer:          #ffffff;
  --drawer-rule:     #ebebeb;
  --drawer-hairline: #f5f5f5;
  --drawer-border:   #dcdcdc;
  --drawer-field:    #fafafa;
  --drawer-cell:     #f5f5f5;

  /* ---- Elevation: five named shadows, nothing else casts one ------------ */
  --shadow-card:   0 1px 2px rgba(20,20,20,0.13), 0 6px 16px -4px rgba(20,20,20,0.23); /* EN: a card or tile at rest, dark enough to be seen; never changes on hover. VN: thẻ hoặc ô khi nghỉ, đủ đậm để nhìn thấy; không đổi khi rê chuột. */
  --shadow-pop:    0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);            /* EN: select panel, date panel, tooltip. VN: bảng chọn, bảng ngày, chú giải. */
  --shadow-1:      0 1px 2px rgba(0,0,0,0.06);
  --shadow-2:      0 8px 24px rgba(0,0,0,0.18);
  --shadow-menu:   0 1px 2px rgba(0,0,0,0.14), 0 8px 24px rgba(0,0,0,0.23);            /* EN: row menu, account popover: open on top of a card, one step darker than the toast. VN: menu hàng, bảng tài khoản: mở nổi trên thẻ, đậm hơn thông báo một bậc. */
  --shadow-toast:  var(--shadow-2);
  --shadow-drawer: 0 8px 24px rgba(0,0,0,0.28);

  /* ---- Motion ----------------------------------------------------------- */
  --ease:        cubic-bezier(0.2,0,0,1);      /* EN: anything the user caused. VN: mọi thứ do người dùng gây ra. */
  --ease-drawer: cubic-bezier(0.2,0.9,0.24,1); /* EN: a surface arriving. VN: một bề mặt đi vào. */
  --ease-out:    cubic-bezier(0.4,0,1,1);      /* EN: a surface leaving. VN: một bề mặt rời đi. */
  --t-feedback: 420ms;  /* EN: hover in and out, rail, drawer, collapse. VN: rê vào và ra, thanh điều hướng, ngăn kéo, thu gọn. */
  --t-enter:    320ms;  /* EN: toast, the copy check. VN: thông báo, dấu tích sao chép. */
  --t-exit:     200ms;  /* EN: an overlay leaving. VN: lớp phủ rời đi. */
  --t-touch:    120ms;  /* EN: press-in on touch. VN: nhấn xuống trên màn cảm ứng. */

  /* ---- Radius: square. Three stated exceptions -------------------------- */
  --radius:       0;
  --radius-input: 1px;  /* EN: token fields, checkboxes. VN: ô nhập, ô đánh dấu. */
  --radius-ctl:   2px;  /* EN: buttons, toast, pager cells, rail rows: the maximum. VN: nút, thông báo, ô phân trang, hàng điều hướng: mức tối đa. */
  --radius-badge: 9px;  /* EN: the count badge, the one round shape (§C59). VN: huy hiệu đếm, hình tròn duy nhất (§C59). */

  /* ---- Type ------------------------------------------------------------- */
  --font-display: 'Space Grotesk', sans-serif;             /* EN: display, titles, every figure. VN: tiêu đề lớn, tiêu đề, mọi con số. */
  --font-body:    'IBM Plex Sans', system-ui, sans-serif;  /* EN: body and record text. VN: chữ thân và chữ bản ghi. */
  --font-mono:    'JetBrains Mono', monospace;             /* EN: labels and machine text. VN: nhãn và chữ máy. */

  /* EN: The scale is closed. A size that is not here does not exist.
     VN: Thang cỡ chữ là đóng. Cỡ không có ở đây thì không tồn tại. */
  --t-display-xl: 96px;
  --t-display-l:  54px;
  --t-display-m:  34px;
  --t-figure-xl:      88px;
  --t-figure-display: 64px;
  --t-figure-inline:  32px;
  --t-title-l:    22px;
  --t-title-m:    16px;
  --t-title-s:    15px;  /* EN: a navigation tile's name (3.0.0). VN: tên của ô điều hướng (3.0.0). */
  --t-body-l:     15px;  /* EN: a record's value when read (3.0.0). VN: giá trị của bản ghi khi đọc (3.0.0). */
  --t-body:       14px;
  --t-body-s:     13px;  /* EN: THE record size: rows, values, menu items. VN: CỠ bản ghi: hàng, giá trị, mục menu. */
  --t-body-xs:    12px;
  --t-mono-value: 13px;
  --t-mono-meta:  11px;
  --t-mono-label: 10px;
  --t-mono-micro:  9px;  /* EN: the floor. Nothing sets smaller. VN: mức sàn. Không gì nhỏ hơn. */

  --w-regular: 400;
  --w-medium:  500;
  --w-bold:    700;  /* EN: marketing headlines and a record's lead name only. VN: chỉ cho tiêu đề tiếp thị và tên chính của bản ghi. */

  /* EN: The height law: a single line of UI text has line-height 1, so
         row height = 2 × padding + font size. Three paddings, three heights.
     VN: Luật chiều cao: một dòng chữ giao diện có line-height 1, nên
         chiều cao hàng = 2 × đệm + cỡ chữ. Ba mức đệm, ba chiều cao. */
  --pad-row:       10px;  /* → 33px: drawer rows */
  --pad-row-tight: 11px;  /* → 35px: child rows  */
  --pad-row-card:  14px;  /* → 41px: table rows  */
  --lh-ui:    1;
  --lh-prose: 1.55;

  /* ---- Chart palette: twelve series colours, used in this order (§2.6) -- */
  /* EN: For a chart with more series than identities. Never a status, never text.
     VN: Cho biểu đồ có nhiều chuỗi hơn danh tính. Không bao giờ là trạng thái hay chữ. */
  --chart-01: #d12d03;
  --chart-02: #e74500;
  --chart-03: #f3b234;
  --chart-04: #979227;
  --chart-05: #63a532;
  --chart-06: #5aa27e;
  --chart-07: #80c4cd;
  --chart-08: #3578d3;
  --chart-09: #2c469a;
  --chart-10: #9362d5;
  --chart-11: #b53d9a;
  --chart-12: #d04870;
}


/* ==========================================================================
   EN: The five places a literal colour is allowed, because each is drawn on
       black or over any surface and cannot follow a surface role:
         1. the company field's ground       #000000
         2. the glass panel over the field   rgba(0,0,0,0.25) + blur(2px),
                                             border rgba(255,255,255,0.14)
         3. the curtain                      rgba(0,0,0,0.56)
         4. the toast and the tooltip        #141414 surface, white ink
         5. the code block                   #141414 surface, white ink
   VN: Năm nơi được phép dùng màu thô, vì mỗi nơi được vẽ trên nền đen hoặc
       trên mọi bề mặt và không thể theo một vai trò bề mặt:
         1. nền của trường công ty; 2. tấm kính trên trường; 3. tấm màn;
         4. thông báo và chú giải; 5. khối mã.
   ========================================================================== */

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }

a       { color: var(--signal); text-decoration: none; }
a:hover { color: var(--ink); }

/* EN: A <button> does not inherit ink: the browser sets its own colour, so a
       glyph drawn with currentColor would vanish on a dark surface.
   VN: <button> không kế thừa màu mực: trình duyệt tự đặt màu, nên glyph vẽ
       bằng currentColor sẽ biến mất trên nền tối. */
button  { font-family: inherit; color: var(--ink); }

/* EN: Form controls do not inherit line-height either; pin it or rows drift.
   VN: Ô điều khiển cũng không kế thừa line-height; phải ghim, nếu không hàng sẽ lệch. */
button, input, select, textarea { line-height: 1; }

/* EN: Hidden means hidden. The browser's own rule loses to any class that sets display, and it does not reach an
       SVG element at all, so a hidden menu, tick or chart cursor would stay on screen without this one.
   VN: Ẩn nghĩa là ẩn. Quy tắc của trình duyệt thua mọi lớp có đặt display, và hoàn toàn không áp tới phần tử SVG,
       nên menu, dấu tích hay con trỏ biểu đồ đang ẩn sẽ vẫn hiện trên màn hình nếu thiếu quy tắc này. */
[hidden] { display: none !important; }

.tnum, [data-figure] { font-variant-numeric: tabular-nums; }

/* EN: Focus is a border colour, never a ring. A control that owns its border
       state (the amount input over its limit) opts out with data-own-focus.
   VN: Tiêu điểm là màu viền, không bao giờ là vòng sáng. Ô tự quản trạng thái
       viền (ô số tiền vượt hạn mức) loại trừ bằng data-own-focus. */
:where(input, textarea, select):focus { outline: none; }
div:has(> input:focus):not([data-own-focus]) { border-color: var(--brand) !important; }

::selection { background: var(--tint); color: var(--tint-ink); }

/* EN: The skeleton breathes on its CONTAINER, so every block shares one phase.
   VN: Khung chờ "thở" trên VẬT CHỨA, để mọi khối cùng một nhịp. */
@keyframes flexo-breathe { 0%,100% { opacity: 1 } 50% { opacity: 0.45 } }
[data-skeleton] { animation: flexo-breathe 1400ms cubic-bezier(0.4,0,0.6,1) infinite; }
[data-skeleton] > * { background: var(--rule); border-radius: 0; }
