/* Datamax - Dr.PONG brand: teal #3a8a93 (--subColor of drpong.vn) + sky #7ad3ff (--mainColor), black wordmark */
:root {
  --brand: #3a8a93; --brand-600: #2f747c; --brand-700: #255d64; --brand-50: #eef7f8; --brand-100: #d6ecee;
  --sky: #7ad3ff; --sky-50: #effaff;
  --bg: #f4f7f9; --panel: #fff; --ink: #0f1a24; --text: #23303d; --muted: #6b7785; --line: #e5eaef; --line-2: #eef2f5;
  --ok: #10855f; --ok-bg: #e8f7f0; --err: #c2362b; --err-bg: #fdeeec; --warn: #9a6200; --warn-bg: #fff6e3;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .05), 0 4px 16px rgba(16, 32, 48, .05);
  --grad: linear-gradient(90deg, var(--brand) 0%, var(--sky) 100%);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.55 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-600); text-decoration: none; } a:hover { color: var(--brand-700); }
h1, h2, h3 { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.stat .k svg { width: 15px; height: 15px; }

/* ---------- Layout: sidebar + content ---------- */
.app { display: flex; min-height: 100vh; }
.side { width: 236px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column;
        position: sticky; top: 0; height: 100vh; }
.side::before { content: ""; display: block; height: 4px; background: var(--grad); }
.logo { display: flex; align-items: baseline; gap: 2px; padding: 18px 22px 20px; font-weight: 700; font-size: 20px; color: var(--ink);
        letter-spacing: -.02em; }
.logo:hover { color: var(--ink); }
.logo .plus { color: var(--brand); font-size: 22px; line-height: 0; transform: translateY(-6px); }
.logo small { font-weight: 500; font-size: 11px; color: var(--muted); margin-left: 6px; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--brand-50); color: var(--brand-700); }
.nav a.on svg { color: var(--brand); }
.side .me { margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center;
          font-weight: 600; font-size: 13px; flex: none; }
.me .who { flex: 1; min-width: 0; } .me .who b { display: block; color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 22px 32px 0; }
.top .crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; } .top .crumbs a { color: var(--muted); }
.top .grow { flex: 1; min-width: 200px; }
main { padding: 18px 32px 56px; max-width: 1280px; }

/* ---------- Building blocks ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
.grid.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .v { display: block; font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; line-height: 1.2; }
.stat .v.sm { font-size: 16px; font-weight: 600; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.accent { background: linear-gradient(135deg, var(--brand) 0%, #4fa8b0 60%, var(--sky) 130%); border: 0; color: #fff; }
.stat.accent .k, .stat.accent .sub { color: rgba(255, 255, 255, .85); } .stat.accent .v { color: #fff; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--brand); background: var(--brand); color: #fff;
       border-radius: var(--radius-sm); padding: 8px 15px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
       transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: 0 2px 8px rgba(58, 138, 147, .25); }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); } .btn.ghost:hover { background: var(--bg); color: var(--ink); box-shadow: none; }
.btn.danger { background: #fff; color: var(--err); border-color: #f1c4bf; } .btn.danger:hover { background: var(--err-bg); box-shadow: none; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
         background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.success, .badge.active { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: var(--err-bg); color: var(--err); }
.badge.running, .badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.key { background: var(--brand-50); color: var(--brand-700); } .badge.key::before { display: none; }
.badge.running::before { animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }

.src { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--text); white-space: nowrap; }
.src .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.src .ic svg { width: 16px; height: 16px; }
.ic.csv { background: #eef4ff; color: #3b5bdb; } .ic.gsheet { background: #e8f6ee; color: #188038; } .ic.api { background: var(--line-2); color: var(--muted); }

.msg { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; background: var(--sky-50); border: 1px solid #cdeefe; color: #13506b; }
.msg.success { background: var(--ok-bg); border-color: #bfe6d5; color: var(--ok); }
.msg.error { background: var(--err-bg); border-color: #f5c9c3; color: var(--err); }
.msg.warning { background: var(--warn-bg); border-color: #f3dcae; color: var(--warn); }
.errorlist { margin: 4px 0; padding-left: 18px; color: var(--err); }
.msg .errorlist { color: inherit; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #fafcfd; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafdfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .title { font-weight: 600; color: var(--ink); } td .title:hover { color: var(--brand-700); }
td .sub { display: block; font-size: 12px; color: var(--muted); }
.empty { padding: 36px; text-align: center; color: var(--muted); }

/* ---------- Forms ---------- */
form p { margin: 0 0 14px; }
label { font-weight: 600; display: block; margin-bottom: 5px; color: var(--ink); }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=search], select, textarea {
  width: 100%; max-width: 560px; padding: 9px 11px; border: 1px solid #d3dbe2; border-radius: var(--radius-sm); font: inherit;
  background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(58, 138, 147, .15); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
input[type=file] { font: inherit; }
.hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.drop { border: 1.5px dashed #c5d3dc; border-radius: var(--radius); padding: 26px; text-align: center; background: #fbfdfe; }
.drop:hover { border-color: var(--brand); background: var(--brand-50); }
.search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search input { max-width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500; font-size: 13px; }
.chip:hover { border-color: var(--brand); color: var(--brand-700); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* columns step */
table.cols td { padding: 8px 12px; }
table.cols input[type=text] { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; padding: 6px 8px; max-width: none; }
table.cols tr.off td:not(.keep) { opacity: .45; }
table.cols .samples { font-size: 12px; color: var(--muted); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }

/* ---------- Wizard ---------- */
.steps { display: flex; gap: 0; margin: 4px 0 20px; padding: 0; counter-reset: s; flex-wrap: wrap; }
.steps li { list-style: none; display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; padding-right: 18px; }
.steps li::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
                    border: 1.5px solid var(--line); background: #fff; font-size: 12.5px; font-weight: 600; }
.steps li:not(:last-child)::after { content: ""; width: 36px; height: 2px; background: var(--line); margin-left: 8px; }
.steps li.done { color: var(--brand-700); } .steps li.done::before { content: "✓"; background: var(--brand); border-color: var(--brand); color: #fff; }
.steps li.on { color: var(--ink); } .steps li.on::before { border-color: var(--brand); color: var(--brand-700); box-shadow: 0 0 0 4px var(--brand-50); }
.kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.kind { display: flex; flex-direction: column; gap: 10px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
        color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s, box-shadow .15s; }
a.kind:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 8px 24px rgba(58, 138, 147, .14); color: var(--text); }
.kind .ic { width: 44px; height: 44px; border-radius: 12px; } .kind .ic svg { width: 22px; height: 22px; }
.kind h3 { margin: 0; font-size: 16px; } .kind p { margin: 0; color: var(--muted); font-size: 13px; }
.kind.soon { opacity: .6; box-shadow: none; } .kind .go { margin-top: auto; color: var(--brand-700); font-weight: 600; font-size: 13px; }

/* ---------- Detail ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); } .tabs a.on { color: var(--brand-700); border-color: var(--brand); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.copy { display: inline-flex; gap: 6px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 3px 8px;
        max-width: 100%; word-break: break-all; }
.progress { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin: 10px 0 0; }
.progress i { display: block; height: 100%; width: 40%; background: var(--grad); border-radius: 999px; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.list { margin: 0; padding: 0; list-style: none; } .list li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; } .list .grow { flex: 1; min-width: 0; }
.list .grow .sub { display: block; overflow: hidden; text-overflow: ellipsis; }
.feed li { padding: 12px 20px; } .feed .meta { text-align: right; flex: none; } .feed .meta .sub { display: block; }
.feed .counts { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.feed .counts b { color: var(--ink); font-weight: 600; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
              background: radial-gradient(1200px 600px at 10% -10%, rgba(122, 211, 255, .35), transparent 60%),
                          radial-gradient(900px 500px at 110% 110%, rgba(58, 138, 147, .25), transparent 60%), var(--bg); }
.login { width: 100%; max-width: 380px; } .login .logo { padding: 0 0 6px; justify-content: center; font-size: 26px; }
.login input { max-width: none; } .login .btn { width: 100%; justify-content: center; padding: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .logo { padding: 12px 16px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0 10px 10px; } .nav .label { display: none; }
  .side .me { display: none; }
  .top, main { padding-left: 16px; padding-right: 16px; }
  .grid.two { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; }
}

/* Schedule picker of a Google Sheet connection (connectors/_schedule.html) */
.sched { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sched .opt { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 12px; border: 1px solid var(--line);
              border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 500; margin: 0; }
.sched .opt.on { border-color: var(--brand); background: var(--brand-50); }
.sched .opt input[type=radio] { width: auto; margin: 0; accent-color: var(--brand); }
.sched .opt input.clock { width: 104px; padding: 5px 8px; text-align: center; }
.sched .opt input.hours { width: 64px; padding: 5px 8px; text-align: center; }
.sched .hint.error { color: var(--err); }

/* User management (accounts/) */
.userline { display: flex; align-items: center; gap: 10px; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; flex: none; }
.roles .opt { align-items: flex-start; } .roles .opt input { margin-top: 3px; }
.roles .opt .sub, .perm .sub { display: block; font-weight: 400; }
.perm-box { margin-top: 4px; } .perm-box.off { opacity: .45; }
label.inline.perm { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
label.inline.perm input { margin-top: 3px; flex: none; }
ul.errorlist { margin: 4px 0 0; padding-left: 18px; color: var(--err); font-size: 12.5px; }
/* Format picker: pattern box + live check (2026-11-10) */
.fmtbox { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.fmtbox select, .fmtbox input.colpat { width: 100%; }
.fmtinfo { font-size: 11.5px; color: var(--muted); line-height: 1.35; max-width: 260px; overflow-wrap: anywhere; }
.fmtinfo.bad { color: var(--err); }
details.pattern-help { margin: 10px 18px 14px; }
details.pattern-help summary { cursor: pointer; color: var(--muted); }
details.pattern-help table.plain { border-collapse: collapse; margin-top: 6px; }
details.pattern-help table.plain td { padding: 2px 14px 2px 0; vertical-align: top; }
