/* หน้าตาเว็บ Bossnoi Studio — โทนดำ-ส้ม, มือถือก่อน */
:root {
  --orange: #f26522;
  --orange-dark: #d4521a;
  --orange-soft: #fff1e9;
  --black: #111111;
  --ink: #1b1b1b;
  --muted: #6b6b6b;
  --line: #e9e6e3;
  --bg: #f6f4f2;
  --card: #ffffff;
  --red: #d93025;
  --red-soft: #fdecea;
  --blue: #1a73e8;
  --blue-soft: #e8f0fe;
  --gray-soft: #efefef;
  --green: #188038;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Sans Thai', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
h1, h2, h3, .brand, .clock-now, .clock-btn-label, .stat-num {
  font-family: 'Prompt', 'Noto Sans Thai', sans-serif;
  line-height: 1.25;
}
h1 { font-size: 1.5rem; margin: 0.4rem 0 0.8rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
a { color: var(--orange-dark); }
code { font-size: 0.92em; background: var(--gray-soft); padding: 1px 6px; border-radius: 6px; word-break: break-all; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center-text { text-align: center; }
.text-red { color: var(--red); }
.req { color: var(--red); }

/* ---------- โครงหน้า ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--black); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--orange); display: inline-block; }
.brand-dot.big { width: 40px; height: 40px; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; background: #2a2a2a; font-size: 0.9rem; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  background: var(--card); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.menu-pop a { color: var(--ink); text-decoration: none; }

.page { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 4px; text-decoration: none; color: var(--muted); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 0.78rem;
}
.bottomnav a.active { color: var(--orange); font-weight: 600; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin: 12px 0;
}
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card.login { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 12px; }
.login-brand h1 { margin: 10px 0 0; }
.login-brand p { margin: 0; }

/* ---------- ฟอร์ม ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 0.95rem; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
label.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--orange); flex-shrink: 0; }
input:not([type=checkbox]), select, textarea {
  font: inherit; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
input:disabled { background: var(--gray-soft); color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 600; padding: 0 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.danger-zone { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; min-height: 46px;
}
.btn-primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-primary:active { background: var(--orange-dark); }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; font-size: 1.4rem; min-height: 40px; padding: 4px 14px; }
.btn-block { width: 100%; margin: 6px 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--orange-dark); cursor: pointer; text-align: left; }

/* ---------- แจ้งเตือน / ป้าย ---------- */
.flash { padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-size: 0.95rem; }
.flash-ok { background: #e6f4ea; color: #12512a; }
.flash-error { background: var(--red-soft); color: #8c1d18; }
.bigcode { font-size: 1.25rem; letter-spacing: 1px; display: inline-block; margin: 4px 0; background: #fff; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-gray { background: var(--gray-soft); color: var(--muted); }
.tag-orange { background: var(--orange-soft); color: var(--orange-dark); }
.empty { color: var(--muted); text-align: center; padding: 18px 0; margin: 0; }

/* ---------- หน้าเข้างาน ---------- */
.clock-card {
  background: var(--black); color: #fff; border-radius: 24px; padding: 22px 18px 18px; margin: 4px 0 12px; text-align: center;
}
.clock-date { color: #bdbdbd; }
.clock-now { font-size: 3.4rem; font-weight: 700; letter-spacing: 1px; margin: 2px 0; font-variant-numeric: tabular-nums; }
.clock-status { display: inline-block; font-size: 0.9rem; padding: 4px 12px; border-radius: 999px; background: #2a2a2a; color: #ddd; }
.clock-status.is-working { background: rgba(242, 101, 34, 0.18); color: #ffb48a; }
.clock-card .flash { text-align: left; }
.clock-card .muted { color: #9a9a9a; }
#clock-form { margin: 22px 0 10px; display: flex; justify-content: center; }
.clock-btn {
  width: min(72vw, 260px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: #fff; font: inherit; -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease;
}
.clock-btn:active { transform: scale(0.96); }
.clock-btn-in { background: radial-gradient(circle at 30% 25%, #ff8a4c, var(--orange) 55%, var(--orange-dark)); box-shadow: 0 0 0 10px rgba(242, 101, 34, 0.16), 0 12px 40px rgba(242, 101, 34, 0.45); }
.clock-btn-out { background: radial-gradient(circle at 30% 25%, #4a4a4a, #2b2b2b 60%, #1c1c1c); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.07), 0 12px 40px rgba(0, 0, 0, 0.5); border: 2px solid var(--orange); }
.clock-btn-label { font-size: 2.3rem; font-weight: 700; }
.clock-btn-sub { font-size: 0.9rem; opacity: 0.85; }
.clock-btn[disabled] { opacity: 0.7; }

/* ---------- รายการ ---------- */
.shift { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.shift-time { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 110px; }

.monthpicker { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); margin: 8px 0 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; }
.stat-num { font-size: 1.6rem; font-weight: 700; }
.stat-label { line-height: 1.3; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-warn .stat-num { color: var(--red); }

.daylist { list-style: none; padding: 0; margin: 0; }
.day { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.day-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.person { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.person:last-child { border-bottom: 0; }
.person.is-off { opacity: 0.5; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-dark); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; font-family: 'Prompt', sans-serif; }
.person-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.person-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.quicklinks { display: flex; gap: 8px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px 0; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 500; font-size: 0.82rem; }
.table a { text-decoration: none; font-weight: 600; }

.editlog { list-style: none; padding: 0; margin: 0; }
.editlog li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.editlog li:last-child { border-bottom: 0; }

.iplist { list-style: none; padding: 0; margin: 12px 0; }
.iplist li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }

@media (min-width: 768px) {
  .page { padding-top: 24px; }
}

/* ---------- งาน ---------- */
.prewrap { white-space: pre-wrap; word-break: break-word; }
.break { word-break: break-all; }
.count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--gray-soft); color: var(--muted); font-size: 0.78rem; font-weight: 600; text-align: center; font-family: 'Noto Sans Thai', sans-serif; vertical-align: middle; }
.section-title { margin: 22px 0 4px; }
h2.inline { display: inline; margin: 0; }
details > summary { cursor: pointer; }

.tabs { display: flex; gap: 4px; background: var(--card); border-radius: 12px; padding: 4px; box-shadow: var(--shadow); margin: 10px 0; }
.tabs a { flex: 1; text-align: center; padding: 8px 0; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.tabs a.active { background: var(--black); color: #fff; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 14px; }
.filters { display: flex; gap: 8px; flex: 1; min-width: 0; }
.filters select { flex: 1; min-width: 0; padding: 10px 12px; font-size: 0.92rem; }

.task-group { margin-bottom: 18px; }
.task-group h2 { font-size: 1rem; margin-bottom: 8px; }
.task {
  display: block; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 11px 13px 10px 15px;
  margin-bottom: 8px; color: inherit; text-decoration: none; border-left: 4px solid var(--blue);
}
.task.tone-red { border-left-color: var(--red); }
.task.tone-gray { border-left-color: #b9b9b9; }
.task.is-done { opacity: 0.6; }
.task.is-done .task-title { text-decoration: line-through; }
.task-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.task-title { font-weight: 600; line-height: 1.4; word-break: break-word; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.meta-project::before { content: '▸ '; color: var(--orange); }
.flag { display: inline-block; background: var(--red); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 2px; }

.pill { display: inline-block; font-size: 0.74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.pill-todo { background: var(--gray-soft); color: #555; }
.pill-doing { background: var(--blue-soft); color: var(--blue); }
.pill-review { background: #f3e8fd; color: #8430ce; }
.pill-revise { background: #fef3e0; color: #b06000; }
.pill-done { background: #e6f4ea; color: var(--green); }

.brand-tag { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--gray-soft); color: #555; }
.brand-bossnoi { background: var(--orange-soft); color: var(--orange-dark); }
.brand-thebossnoi { background: #1b1b1b; color: #fff; }
.brand-restaurant { background: #e6f4ea; color: var(--green); }

.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x mandatory; }
.column { flex: 0 0 82%; max-width: 300px; background: #ecebe9; border-radius: 14px; padding: 10px; scroll-snap-align: start; }
.column h2 { font-size: 0.95rem; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.column-body { min-height: 80px; }
.column .task-top .pill { display: none; }
.drag-ghost { opacity: 0.4; }
@media (min-width: 900px) {
  .page:has(.board) { max-width: 1400px; }
  .board { margin: 0; padding-left: 0; padding-right: 0; }
  .column { flex: 1 1 0; max-width: none; }
}

.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.project-head h1 { margin: 6px 0 2px; }
.project-head p { margin: 2px 0; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.project-card { display: flex; flex-direction: column; gap: 6px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; color: inherit; text-decoration: none; }
.project-card h2 { margin: 2px 0 0; }
.project-card.is-off { opacity: 0.55; }
.project-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.avatars { display: flex; }
.avatar.sm { width: 28px; height: 28px; font-size: 0.75rem; border: 2px solid #fff; margin-left: -6px; }
.avatars .avatar.sm:first-child { margin-left: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
textarea { font: inherit; resize: vertical; }

.task-detail h1 { margin: 8px 0 12px; word-break: break-word; }
.task-detail-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.props { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0 0 12px; }
.props dt { color: var(--muted); font-size: 0.9rem; }
.props dd { margin: 0; min-width: 0; }
.note { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.status-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-ok { background: var(--green); border-color: var(--green); color: #fff; }
.quick-status { border-top: 1px solid var(--line); padding-top: 12px; }
.comments { list-style: none; padding: 0; margin: 0 0 12px; }
.comments li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.comments .avatar.sm { margin-left: 0; border: 0; }
.events { list-style: none; padding: 0; margin: 0; font-size: 0.88rem; }
.events li { padding: 5px 0; }
.person-group h3 { font-size: 0.95rem; margin: 12px 0 6px; }

/* ---------- ปฏิทิน ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.cal-head { text-align: center; font-size: 0.78rem; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 64px; border-radius: 8px; padding: 3px; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; overflow: hidden; background: #faf9f8; }
.cal-cell.is-empty { background: transparent; }
.cal-cell.is-today .cal-num { background: var(--orange); color: #fff; }
.cal-cell.is-selected { outline: 2px solid var(--black); }
.cal-num { font-size: 0.8rem; font-weight: 600; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cal-chip { font-size: 0.66rem; line-height: 1.3; padding: 1px 4px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.cal-more { font-size: 0.66rem; color: var(--muted); padding-left: 3px; }
.ev-company { background: #3c4043; }
.ev-workshop { background: var(--orange); }
.ev-private { background: #8430ce; }
.tk-blue { background: var(--blue); }
.tk-red { background: var(--red); }
.tk-gray, .tk-done { background: #b9b9b9; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 2px; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
@media (min-width: 768px) {
  .cal-cell { min-height: 96px; padding: 5px; }
  .cal-chip { font-size: 0.74rem; }
}

.event-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; background: var(--bg); color: inherit; text-decoration: none; border-left: 4px solid #3c4043; }
.event-row.ev-company, .event-row.ev-workshop, .event-row.ev-private, .event-row.tk-blue, .event-row.tk-red, .event-row.tk-gray, .event-row.tk-done { background: var(--bg); }
.event-row.ev-workshop { border-left-color: var(--orange); }
.event-row.ev-private { border-left-color: #8430ce; }
.event-row.tk-blue { border-left-color: var(--blue); }
.event-row.tk-red { border-left-color: var(--red); }
.event-row.tk-gray, .event-row.tk-done { border-left-color: #b9b9b9; }
.event-time { font-size: 0.82rem; font-weight: 600; min-width: 74px; color: var(--muted); }
.event-main { display: flex; flex-direction: column; min-width: 0; }
.ev-tag-company { background: #3c4043; color: #fff; }
.ev-tag-workshop { background: var(--orange); color: #fff; }
.ev-tag-private { background: #8430ce; color: #fff; }

/* ---------- นักเรียน workshop ---------- */
.students { list-style: none; padding: 0; margin: 0 0 12px; }
.student { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.student-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 180px; }
.att-buttons { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.att-btn { min-height: 38px; padding: 6px 12px; font-size: 0.88rem; }
.att-btn.on-present { background: var(--green); border-color: var(--green); color: #fff; }
.att-btn.on-absent { background: var(--red); border-color: var(--red); color: #fff; }
.student.att-present { background: linear-gradient(90deg, #e6f4ea, transparent 60%); }
.student.att-absent { background: linear-gradient(90deg, var(--red-soft), transparent 60%); }
.student-edit { width: 100%; }
.student-edit summary { color: var(--muted); padding: 4px 0; }
.add-student > summary { list-style: none; }
.add-student > summary::-webkit-details-marker { display: none; }

/* ---------- แจ้งเตือน ---------- */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; color: #fff; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #2a2a2a; }
.bell .ico { width: 20px; height: 20px; }
.bell-badge { position: absolute; top: -4px; right: -4px; background: var(--orange); color: #fff; font-size: 0.68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li a { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; color: inherit; text-decoration: none; background: var(--card); margin-bottom: 6px; box-shadow: var(--shadow); }
.notif-list li.is-new a { border-left: 4px solid var(--orange); }
.notif-list .avatar.sm { margin-left: 0; border: 0; }
.notif-main { display: flex; flex-direction: column; }

/* ---------- ไฟล์ ---------- */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.folder-tile { display: flex; flex-direction: column; gap: 2px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; color: inherit; text-decoration: none; border: 1px solid var(--line); }
.folder-ico { font-size: 1.6rem; color: var(--orange); line-height: 1; }
.crumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.file-list { list-style: none; padding: 0; margin: 0; }
.file-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.file-list li:last-child .file-row { border-bottom: 0; }
.file-ico { font-size: 1.5rem; width: 36px; text-align: center; }
.file-main { display: flex; flex-direction: column; min-width: 0; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px; border: 2px dashed #d6d2ce; border-radius: 16px; background: var(--card); cursor: pointer; text-align: center; font-weight: 400; }
.dropzone.over { border-color: var(--orange); background: var(--orange-soft); }
.dropzone input { display: none; }
.dropzone strong { color: var(--orange-dark); }
.upload-list { list-style: none; padding: 0; margin: 8px 0; }
.upload-list li { background: var(--card); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; box-shadow: var(--shadow); }
.up-name { font-weight: 600; font-size: 0.9rem; word-break: break-all; }
.bar { height: 6px; background: var(--gray-soft); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.bar span { display: block; height: 100%; width: 0; background: var(--orange); transition: width 0.3s; }
.upload-list li.done .bar span { background: var(--green); }
.upload-list li.failed .bar span { background: var(--red); }
.viewer { background: #000; border-radius: var(--radius); overflow: hidden; margin: 8px 0; display: flex; justify-content: center; }
.viewer video, .viewer img { width: 100%; max-height: 70vh; object-fit: contain; display: block; }
.viewer audio { width: 100%; margin: 20px; }
.viewer iframe { width: 100%; height: 75vh; border: 0; background: #fff; }
.viewer-none { color: #ccc; padding: 40px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 2rem; }
.viewer-none span { font-size: 0.9rem; }
.timecode { background: var(--orange); color: #fff; border: 0; border-radius: 6px; font: inherit; font-size: 0.78rem; font-weight: 700; padding: 1px 7px; margin-right: 6px; cursor: pointer; }
.comments li.is-resolved { opacity: 0.5; }
.grow { flex: 1; min-width: 0; }
.rec-preview { width: 100%; border-radius: 12px; background: #111; aspect-ratio: 16 / 9; }

/* ---------- Whiteboard ---------- */
.board-page { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.board-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--black); color: #fff; }
.board-back { color: #fff; text-decoration: none; font-size: 1.6rem; line-height: 1; padding: 0 6px; }
.board-title-form { flex: 1; min-width: 0; }
.board-title-form input { background: transparent; border: 0; color: #fff; font-family: 'Prompt', sans-serif; font-size: 1.05rem; padding: 6px; width: 100%; }
.board-title-form input:focus { background: #2a2a2a; outline: none; }
.board-status { font-size: 0.8rem; color: #aaa; white-space: nowrap; }
.board-status.ok { color: #7bd88f; }
.board-status.err { color: #ff8a80; }
.board-del { background: none; border: 0; cursor: pointer; font-size: 1.1rem; }
#board { flex: 1; min-height: 0; }
.board-thumb { font-size: 1.8rem; color: var(--orange); }

/* ---------- เงินเดือน ---------- */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.slip { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 12px 0; border-top: 6px solid var(--orange); }
.slip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.slip-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.slip-table td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.slip-sec td { font-weight: 600; color: var(--muted); font-size: 0.85rem; padding-top: 14px; border-bottom: 0; }
.slip-total td { font-weight: 600; }
.slip-net td { font-family: 'Prompt', sans-serif; font-size: 1.25rem; font-weight: 700; border-bottom: 0; padding-top: 12px; color: var(--orange-dark); }
.pay-list { list-style: none; padding: 0; margin: 0 0 10px; }
.pay-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---------- Dashboard ---------- */
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: 'Noto Sans Thai', sans-serif; }
.chart .bar { fill: var(--orange); }
.chart .hit { fill: transparent; }
.chart .bar-g:hover .hit { fill: rgba(0, 0, 0, 0.04); }
.chart .bar-g:hover .bar { fill: var(--orange-dark); }
.hbars { list-style: none; padding: 0; margin: 0; }
.hbars li { padding: 8px 0; }
.hbar-label { display: flex; justify-content: space-between; gap: 10px; font-size: 0.92rem; }
.hbar { height: 10px; background: var(--gray-soft); border-radius: 0 4px 4px 0; margin: 4px 0 2px; overflow: hidden; }
.hbar span { display: block; height: 100%; background: var(--orange); border-radius: 0 4px 4px 0; }
.link-card { display: flex; justify-content: space-between; align-items: center; color: inherit; text-decoration: none; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.person-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.person-card-head { display: flex; align-items: center; gap: 10px; }
.mini-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; font-size: 0.72rem; color: var(--muted); }
.mini-stats span { background: var(--bg); border-radius: 8px; padding: 6px 2px; display: flex; flex-direction: column; }
.mini-stats b { font-size: 1.1rem; color: var(--ink); font-family: 'Prompt', sans-serif; }
.mini-stats .warn b { color: var(--red); }
.current { list-style: none; padding: 0; margin: 0; }
.current li a { display: flex; gap: 6px; align-items: baseline; padding: 4px 0; color: inherit; text-decoration: none; font-size: 0.9rem; flex-wrap: wrap; }
.person-card-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; margin-top: auto; }
.stats-wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats-wide .stat-num { font-size: clamp(1.1rem, 5vw, 1.5rem); word-break: break-all; }

/* ---------- Ally ผู้ช่วย AI ---------- */
.ally-fab {
  position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30;
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--black); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); display: grid; place-items: center;
}
.ally-fab-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--orange); display: inline-block; box-shadow: 0 0 0 4px rgba(242, 101, 34, 0.25); }
.ally-panel {
  position: fixed; right: 16px; bottom: calc(136px + env(safe-area-inset-bottom)); z-index: 31;
  width: min(400px, calc(100vw - 32px)); height: min(560px, calc(100vh - 200px));
  background: var(--card); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  display: none; flex-direction: column; overflow: hidden;
}
.ally-panel.open { display: flex; }
.ally-panel-full { position: static; width: auto; height: calc(100vh - 230px); min-height: 380px; box-shadow: var(--shadow); margin-bottom: 16px; }
.ally-head { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.ally-title { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.ally-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ally-icon-btn { border: 0; background: none; font-size: 1.05rem; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.ally-icon-btn:hover { background: var(--gray-soft); }
.ally-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ally-msg { max-width: 85%; padding: 8px 12px; border-radius: 14px; line-height: 1.5; word-wrap: break-word; }
.ally-user { align-self: flex-end; background: var(--orange); color: #fff; border-bottom-right-radius: 4px; }
.ally-ally { align-self: flex-start; background: var(--gray-soft); border-bottom-left-radius: 4px; }
.ally-msg.pending::after { content: '…'; animation: ally-blink 1s infinite; }
.ally-error { background: var(--red-soft); color: var(--red); }
.ally-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.ally-input textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font: inherit; max-height: 120px; }
.ally-mic, .ally-send { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.1rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.ally-mic { background: var(--orange-soft); }
.ally-send { background: var(--black); color: #fff; }
.ally-panel.listening .ally-mic { background: var(--red); color: #fff; animation: ally-pulse 1s infinite; }
.ally-token { display: block; padding: 10px; margin: 6px 0; user-select: all; }
.ally-devices summary { cursor: pointer; font-weight: 600; }
.ally-devices .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 8px; }
.ally-devices input { flex: 1; }
@keyframes ally-blink { 50% { opacity: 0.2; } }
@keyframes ally-pulse { 50% { box-shadow: 0 0 0 8px rgba(217, 48, 37, 0.2); } }
