/* Migration Tool Selector - stylesheet */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f0f4f9;
  --ink: #1d2430;
  --ink-2: #5d6674;
  --line: #d9e0ea;
  --line-2: #eef2f7;
  --brand: #2f6fb5;
  --brand-ink: #1f4e82;
  --purple: #7a4fb0;
  --green: #1f8a5f;
  --amber: #b5651f;
  --red: #b3372f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,30,50,.06), 0 6px 20px rgba(20,30,50,.06);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
}

:root[data-theme="dark"],
html:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d;
    --surface: #1a2029;
    --surface-2: #222a35;
    --ink: #e8edf4;
    --ink-2: #a3aebd;
    --line: #313b49;
    --line-2: #262f3b;
    --brand: #6ba3e0;
    --brand-ink: #9cc3ee;
    --purple: #b08fdd;
    --green: #56bf92;
    --amber: #dd9a5a;
    --red: #e4837b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d;
  --surface: #1a2029;
  --surface-2: #222a35;
  --ink: #e8edf4;
  --ink-2: #a3aebd;
  --line: #313b49;
  --line-2: #262f3b;
  --brand: #6ba3e0;
  --brand-ink: #9cc3ee;
  --purple: #b08fdd;
  --green: #56bf92;
  --amber: #dd9a5a;
  --red: #e4837b;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

a { color: var(--brand); }
a:hover { color: var(--brand-ink); }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 6px; z-index: 50; }

/* ------------------------------------------------------------------ top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { color: var(--brand); display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: var(--ink-2); font-size: 11.5px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav > a { padding: 7px 11px; border-radius: 7px; text-decoration: none; color: var(--ink-2); font-size: 14px; }
.nav > a:hover { background: var(--surface-2); color: var(--ink); }
.nav > a.on { color: var(--brand); background: var(--surface-2); font-weight: 600; }
.who { font-size: 13px; color: var(--ink-2); padding: 0 6px; border-left: 1px solid var(--line); margin-left: 6px; }
.theme-toggle { background: none; border: 1px solid var(--line); color: var(--ink-2); border-radius: 7px; width: 34px; height: 32px; cursor: pointer; font-size: 14px; }
.theme-toggle:hover { background: var(--surface-2); }
.t-light { display: none; }
:root[data-theme="dark"] .t-dark { display: none; }
:root[data-theme="dark"] .t-light { display: inline; }

/* -------------------------------------------------------------------- flash */
.flash { margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; border-left: 3px solid var(--brand); background: var(--surface); font-size: 14px; box-shadow: var(--shadow); }
.flash-ok { border-left-color: var(--green); }
.flash-warn { border-left-color: var(--amber); }

/* --------------------------------------------------------------- typography */
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.015em; }
h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 15.5px; margin: 0 0 8px; }
.lede { color: var(--ink-2); font-size: 16px; max-width: 76ch; margin: 0 0 20px; }
.muted { color: var(--ink-2); }
.fine { font-size: 12.5px; color: var(--ink-2); }

/* -------------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
section.block { padding: 26px 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand); color: #fff; text-decoration: none; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--brand-ink); color: #fff; }
.btn-quiet { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------- badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface-2); white-space: nowrap; }
.badge.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.badge.mid { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.badge.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.badge.eol { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* -------------------------------------------------------------------- forms */
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; background: var(--surface); }
legend { font-weight: 700; padding: 0 8px; font-size: 14px; }
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.hint { font-size: 12.5px; color: var(--ink-2); font-weight: 400; margin: 3px 0 0; }
input[type=text], input[type=email], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; border-color: var(--brand); }
textarea { min-height: 72px; resize: vertical; }
.field { margin-bottom: 14px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.checks label { font-weight: 400; font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 5px 0; cursor: pointer; }
.checks input { margin-top: 3px; flex: none; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ------------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
thead th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ------------------------------------------------------------------ results */
.pick { border-left: 4px solid var(--green); }
.pick h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.score { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 2px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-2); padding: 5px 0; }
.kv dd { margin: 0; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.kv dt { border-bottom: 1px solid var(--line-2); }
ul.tight { margin: 6px 0 0; padding-left: 20px; }
ul.tight li { margin-bottom: 5px; }
ul.warn li::marker { color: var(--amber); }
ul.good li::marker { color: var(--green); }

.diagram { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow-x: auto; }
.diagram svg { display: block; max-width: 100%; height: auto; min-width: 780px; }

.alt { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.alt h3 { margin-bottom: 4px; }
.alt .vendor { font-size: 12.5px; color: var(--ink-2); margin: 0 0 8px; }

.stat { text-align: left; }
.stat b { display: block; font-size: 26px; line-height: 1.1; color: var(--brand); }
.stat span { font-size: 13px; color: var(--ink-2); }

.phase { border-left: 2px solid var(--line); padding-left: 16px; margin-left: 6px; position: relative; padding-bottom: 14px; }
.phase::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.phase h3 { margin-bottom: 2px; }

details.tool { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 8px; }
details.tool > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.tool > div { padding: 0 16px 16px; border-top: 1px solid var(--line-2); padding-top: 12px; }

/* --------------------------------------------------------------------- hero */
.hero { padding: 44px 0 30px; }
.hero h1 { font-size: 38px; max-width: 20ch; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }
.chip { font-size: 12.5px; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }

/* ------------------------------------------------------------------- footer */
.foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 34px; background: var(--surface); }
.foot p { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }

@media print {
  .topbar, .foot, .btn-row, .theme-toggle, .flash { display: none !important; }
  body { background: #fff; }
  .card, .tbl-wrap { box-shadow: none; break-inside: avoid; }
}

/* ------------------------------------------------- niyyasoft.com integration */
/* Added when the tool was mounted at /apps/migration-tool-selector/. The shell
   carries the site's sign-in state and leads back to niyyasoft.com. */

.topbar-auth { display: flex; align-items: center; gap: 6px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--line); }
.who { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); text-decoration: none; padding: 4px 6px; border-radius: 7px; }
a.who:hover { background: var(--surface-2); color: var(--ink); }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
}
.flash-info { border-left-color: var(--brand); }

/* A delete control that posts a form but reads as a link. */
.linkish {
  background: none; border: 0; padding: 0; font: inherit; font-size: inherit;
  color: var(--brand); cursor: pointer; text-decoration: underline;
}
.linkish:hover { color: var(--brand-ink); }

@media (max-width: 720px) {
  .topbar-auth { border-left: 0; padding-left: 0; margin-left: 0; }
}
