:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f8fafc;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --ok: #059669;
  --err: #dc2626;
  --warn: #d97706;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: #0f172a; color: #fff;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 17px; display: flex; gap: 10px; align-items: center; }
.brand i { color: #a5b4fc; }
.brand span { font-weight: 400; color: #94a3b8; }
.top-actions { display: flex; gap: 8px; }
.top .btn.ghost { color: #fff; border-color: #334155; background: transparent; }
.top .btn.ghost:hover { background: #1e293b; }

/* Sign-in screens */
main.narrow { max-width: 460px; margin: 64px auto; padding: 0 16px; display: flex; flex-direction: column; gap: 18px; }

/* Settings layout: tabs on the left, one section on the right */
.layout {
  max-width: 1120px; margin: 28px auto; padding: 0 20px 60px;
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start;
}
.side {
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 84px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px;
}
.side-tab {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; background: transparent; color: var(--text); text-align: left;
  padding: 10px 12px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 500;
}
.side-tab i { width: 18px; text-align: center; color: var(--muted); }
.side-tab:hover:not([disabled]) { background: var(--soft); }
.side-tab.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.side-tab.active i { color: var(--brand); }
.side-tab[disabled] { opacity: .45; cursor: not-allowed; }
.panels { min-width: 0; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px 28px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card h2 { margin: 0 0 6px; font-size: 18px; display: flex; gap: 10px; align-items: center; }
.card h2 i { color: var(--brand); }
.card h3 { margin: 0 0 4px; font-size: 14px; }
.panel-head { border-bottom: 1px solid var(--line); margin: 0 0 20px; padding-bottom: 14px; }
.panel-head .muted { margin: 0; }
.muted { color: var(--muted); margin: 0 0 14px; line-height: 1.55; }
h3.sub { margin: 24px 0 10px; font-size: 13px; color: var(--muted); }

/* Forms */
.grid { display: grid; gap: 14px; max-width: 640px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label small { font-weight: 400; color: var(--muted); line-height: 1.45; }
input[type=text], input:not([type]), input[type=password], input[type=number], input[type=email], input[type=file] {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font: inherit; background: #fff; color: var(--text);
}
input[type=file] { padding: 8px; background: var(--soft); }
input:focus { outline: 2px solid rgba(79, 70, 229, .25); border-color: var(--brand); }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; grid-column: 1 / -1; padding-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 9px;
  padding: 9px 16px; font: inherit; font-weight: 600;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--soft); }
.btn[disabled] { opacity: .6; cursor: wait; }
.msg { grid-column: 1 / -1; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.msg:empty { display: none; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }
.msg.info { color: var(--muted); }

/* Fields / URL switch */
.seg { display: inline-flex; gap: 2px; margin-bottom: 18px; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
.seg-btn { border: 0; background: transparent; border-radius: 7px; padding: 6px 14px; cursor: pointer; font: inherit; font-weight: 500; color: var(--muted); }
.seg-btn.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }

/* Overview */
.status { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--soft); }
.stat b { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.pill.ok { color: var(--ok); }
.pill.err { color: var(--err); }
.pill.warn { color: var(--warn); }
.wb-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wb-tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.wb-tab.active { border-color: #c7d2fe; background: var(--brand-soft); color: var(--brand-dark); }
.wb-tab-tag { font-size: 11px; font-weight: 500; color: var(--muted); }
.wb-tab .wb-count { margin-left: 0; }
.wb-note { color: var(--muted); font-size: 13px; }
.wb-hidden { margin: 8px 2px 0; color: var(--muted); font-size: 12px; }
.wb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.wb { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.wb.own { border-color: #c7d2fe; }
.wb-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
.wb.own .wb-head { background: var(--brand-soft); }
.wb-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; font-weight: 600; color: var(--brand-dark); background: #fff; border: 1px solid #c7d2fe; border-radius: 999px; padding: 1px 8px; }
.wb table { margin: 0; }
.wb th, .wb td { padding: 7px 14px; }

/* Data tools */
.tool-list { display: flex; flex-direction: column; }
.tool { display: flex; align-items: center; gap: 20px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.tool:first-child { padding-top: 0; }
.tool:last-child { border-bottom: 0; padding-bottom: 0; }
.tool-text { flex: 1; min-width: 0; }
.tool-text .muted { margin: 0; }
.tool-text .msg { margin-top: 6px; }
.tool-text .steps { margin: 8px 0 10px; padding-left: 20px; }
.tool-text .steps li { margin: 2px 0; }
.link { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--brand); cursor: pointer; text-decoration: underline; }
.offscreen { position: fixed; left: -9999px; top: 0; }
.drive-row { display: flex; gap: 10px; }
.drive-row input { flex: 1; min-width: 0; }
.choice { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; margin: 0; display: grid; gap: 8px; }
.choice legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.choice .check { align-items: flex-start; }
.choice .check input { margin-top: 3px; }
.choice .check span { font-weight: 400; line-height: 1.45; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; margin-top: 16px; }
  .side { position: static; flex-direction: row; overflow-x: auto; }
  .side-tab { width: auto; flex: 0 0 auto; }
  .grid2 { grid-template-columns: 1fr; }
  .tool { flex-direction: column; align-items: stretch; }
  .drive-row { flex-direction: column; }
}
@media (max-width: 600px) {
  .top { padding: 10px 14px; gap: 10px; }
  .brand span { display: none; }
  .top-actions { gap: 6px; }
  .top .btn { padding: 8px 10px; }
  .layout { padding-left: 12px; padding-right: 12px; }
  .card { padding: 20px; }
}
