@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&display=swap');

:root {
  --ink: #0e1b2e;
  --ink-2: #3b4a5e;
  --ink-3: #74829a;
  --paper: #f3f6f8;
  --white: #ffffff;
  --line: #d8dfe6;
  --chill: #1fa7c2;
  --chill-deep: #0f7f96;
  --chill-wash: #e2f5f8;
  --amber: #d9931b;
  --amber-wash: #fbf1dc;
  --red: #c43d3d;
  --red-wash: #fbe7e7;
  --green: #2e8b57;
  --green-wash: #e3f3ea;
  --r: 6px;
  --r-lg: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: 'IBM Plex Sans Thai', system-ui, sans-serif; font-size: 16px; line-height: 1.55;
  color: var(--ink); background: var(--paper);
}
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 12px; }
a { color: var(--chill-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.hidden { display: none !important; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=password], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--chill); box-shadow: 0 0 0 3px var(--chill-wash); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--r);
  border: 1px solid var(--ink); background: var(--ink); color: var(--white); font-weight: 500; text-decoration: none;
}
.btn:hover { background: #1b2c46; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: var(--chill-deep); border-color: var(--chill-deep); }
.btn.primary:hover { background: #0c6a7d; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--white); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 14px; }
.btn.block { width: 100%; }

/* Messages */
.notice { padding: 12px 14px; border-radius: var(--r); border: 1px solid; margin: 0 0 14px; font-size: 14.5px; }
.notice.error { background: var(--red-wash); border-color: #efc4c4; color: #7a1f1f; }
.notice.ok { background: var(--green-wash); border-color: #b9dfc9; color: #1c5a38; }
.notice.warn { background: var(--amber-wash); border-color: #efd9a8; color: #6b4a08; }
.notice.info { background: var(--chill-wash); border-color: #bde6ee; color: #0b4f5c; }

/* Status dot */
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.status.received::before, .status.awaiting_unit::before { background: var(--amber); }
.status.inspecting::before, .status.repairing::before, .status.replacing::before { background: var(--chill); }
.status.shipped::before, .status.closed::before, .status.active::before, .status.extended::before { background: var(--green); }
.status.rejected::before, .status.void::before, .status.expired::before { background: var(--red); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--white); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--ink-3); font-size: 13px; background: #fafbfc; position: sticky; top: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7fafc; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--white); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 14px; font-size: 14px; }
.timeline li::before { content: ''; position: absolute; left: -24px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--white); border: 2px solid var(--chill); }
.timeline li:last-child::before { background: var(--chill); }
.timeline .when { font-size: 12.5px; color: var(--ink-3); }

/* Focus */
:focus-visible { outline: 2px solid var(--chill); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
