/* Shared chrome for the sign-in screen and the in-app account UI.
   Same visual language as the viewer: system-ui 13px, #2f6fd6 accent,
   white cards on a soft ground, quiet borders. */

/* login.html loads this stylesheet alone, so the reset has to live here —
   without it `width: 100%` inputs add their padding and border on top and
   overhang the card. viewer.html sets the same rule for itself. */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --accent: #2f6fd6;
  --accent-dark: #245ec0;
  --ink: #222;
  --ink-soft: #777;
  --ink-faint: #9a9a9a;
  --line: #d5d5d5;
  --line-soft: #e9e9ee;
  --card: #fff;
  --danger: #b04a3f;
  --ok: #2c7a4b;
  --warn: #9a6a12;
  --shadow: 0 3px 14px rgba(0, 0, 0, .13);
}

.auth-page {
  margin: 0;
  min-height: 100%;
  font: 13px system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #f4f6fb 0%, #eef1f8 55%, #e9edf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}

.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-brand svg { color: var(--accent); flex: none; }
.auth-brand h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.auth-sub { color: var(--ink-faint); font-size: 12px; margin: 0 0 20px; line-height: 1.45; }

.auth-tabs { display: flex; gap: 4px; margin-bottom: 18px; background: #f1f3f8;
             padding: 3px; border-radius: 8px; }
.auth-tabs button { flex: 1; border: none; background: transparent; cursor: pointer;
                    font: inherit; font-weight: 600; color: var(--ink-soft);
                    padding: 7px 8px; border-radius: 6px; }
.auth-tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.09); }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
               margin-bottom: 5px; letter-spacing: .01em; }
.field input {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid #cfd4e0;
  border-radius: 7px; background: #fdfdff; color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus { outline: none; border-color: var(--accent);
                     box-shadow: 0 0 0 3px rgba(47, 111, 214, .15); }
.field .hint { font-size: 11px; color: var(--ink-faint); margin-top: 5px; line-height: 1.4; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 7px;
  padding: 9px 14px; border: 1px solid transparent; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-quiet { background: #fff; color: var(--accent); border-color: #cfd6e4; }
.btn-quiet:hover:not(:disabled) { background: #eef2fb; }
.btn-danger { background: #fff; color: var(--danger); border-color: #e3c6c2; }
.btn-danger:hover:not(:disabled) { background: #fdf2f0; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; border-radius: 6px; }

.notice { border-radius: 7px; padding: 9px 11px; font-size: 12px; line-height: 1.45;
          margin-bottom: 14px; display: none; }
.notice.show { display: block; }
.notice.error { background: #fdf1ef; color: #8d3a30; border: 1px solid #f0d3cd; }
.notice.ok { background: #eef8f1; color: #24603d; border: 1px solid #cfe7d8; }
.notice.info { background: #eff4fd; color: #2b5091; border: 1px solid #d3e0f6; }

.auth-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
             font-size: 11px; color: var(--ink-faint); line-height: 1.5; }

/* ---- in-app account bar (viewer, top-right) ---- */

#acct { position: absolute; right: 12px; top: 12px; z-index: 70;
        display: flex; align-items: center; gap: 6px;
        background: var(--card); border: 1px solid var(--line); border-radius: 8px;
        box-shadow: var(--shadow); padding: 5px 6px 5px 11px;
        font: 13px system-ui, sans-serif; }
#acctName { font-weight: 600; max-width: 160px; overflow: hidden;
            text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
        font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.role.admin  { background: #efe6fb; color: #5b3a9e; }
.role.editor { background: #e5edff; color: #2f6fd6; }
.role.viewer { background: #f0f0f3; color: #767680; }
#acct button { border: none; background: transparent; cursor: pointer; font: inherit;
               color: var(--ink-soft); padding: 4px 7px; border-radius: 5px; }
#acct button:hover { background: #eef2fb; color: var(--accent); }
/* Icon-only buttons need to be square and optically centred, not text-sized. */
#acct button.icon { display: inline-flex; align-items: center; justify-content: center;
                    padding: 5px; line-height: 0; }

/* ---- edit-lock banner (top-center) ---- */

/* Stacked directly under the account chip: both answer "what is my standing
   here", and anchoring right keeps it clear of the library panel on the left
   and of draw.io's toolbars when the editor is open. */
#lockBar { position: absolute; right: 12px; top: 50px; z-index: 65;
           display: none; align-items: center; gap: 9px; flex-wrap: wrap;
           border-radius: 8px; padding: 7px 12px; box-shadow: var(--shadow);
           font: 13px system-ui, sans-serif; max-width: min(400px, 52vw); }
#lockBar.show { display: flex; }
#lockBar.theirs { background: #fff6e5; border: 1px solid #f0dcb4; color: #7a5410; }
#lockBar.mine   { background: #e9f2ff; border: 1px solid #c9dcf8; color: #2b5091; }
#lockBar .who { font-weight: 650; }
#lockBar .when { opacity: .75; font-size: 11.5px; }

/* ---- modals ---- */

.modal { position: fixed; inset: 0; z-index: 200; display: none;
         align-items: flex-start; justify-content: center;
         background: rgba(24, 27, 34, .38); padding: 48px 16px; overflow-y: auto; }
.modal.show { display: flex; }
.modal-card { background: var(--card); border-radius: 12px; box-shadow: 0 12px 44px rgba(0,0,0,.26);
              width: 100%; max-width: 720px; overflow: hidden;
              font: 13px system-ui, sans-serif; color: var(--ink); }
.modal-card.narrow { max-width: 400px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px;
              border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.modal-head .x { border: none; background: transparent; font-size: 19px; line-height: 1;
                 cursor: pointer; color: var(--ink-faint); padding: 2px 6px; border-radius: 5px; }
.modal-head .x:hover { background: #f0f0f4; color: var(--ink); }
.modal-body { padding: 16px 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal-body > p.lede { margin: 0 0 14px; color: var(--ink-soft); line-height: 1.5; }

.section-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
                 color: var(--ink-faint); font-weight: 700; margin: 20px 0 8px; }
.section-title:first-child { margin-top: 0; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 10.5px; text-transform: uppercase;
                letter-spacing: .06em; color: var(--ink-faint); font-weight: 700;
                padding: 0 8px 6px 0; border-bottom: 1px solid var(--line-soft); }
table.grid td { padding: 9px 8px 9px 0; border-bottom: 1px solid #f2f2f5; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid td.actions { text-align: right; white-space: nowrap; }
table.grid td.actions .btn { margin-left: 5px; }
.who-cell .n { font-weight: 600; }
.who-cell .e { color: var(--ink-faint); font-size: 11.5px; }
.muted { color: var(--ink-faint); }
.empty { color: var(--ink-faint); font-style: italic; padding: 10px 0; }

/* ---- version history ---- */

.ver { border: 1px solid var(--line-soft); border-radius: 9px; margin-bottom: 9px;
       overflow: hidden; }
.ver-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
            cursor: pointer; background: #fbfbfd; }
.ver-head:hover { background: #f4f6fb; }
.ver-head .vtarget { font-weight: 650; min-width: 0; overflow: hidden;
                     text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.ver-head .vwho { color: var(--ink-soft); }
.ver-head .vwhen { color: var(--ink-faint); font-size: 11.5px; }
.ver-head .vspacer { flex: 1; }
.ver-open { background: #eff9f1 !important; }
.chip { font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
        letter-spacing: .02em; white-space: nowrap; }
.chip.added    { background: #e6f6ec; color: #24603d; }
.chip.removed  { background: #fdeceb; color: #8d3a30; }
.chip.relabeled{ background: #eef2fd; color: #2b5091; }
.chip.moved    { background: #f2f0fb; color: #55409b; }
.chip.restyled { background: #fdf4e6; color: #8a6412; }
.chip.rewired  { background: #e9f6f8; color: #1c5f6b; }
.chip.live     { background: #e6f6ec; color: #24603d; }
.ver-body { display: none; padding: 4px 12px 12px; border-top: 1px solid var(--line-soft); }
.ver.open .ver-body { display: block; }
.ver-diagram { margin-top: 10px; }
.ver-diagram > h4 { margin: 0 0 6px; font-size: 12.5px; font-weight: 650;
                    display: flex; align-items: center; gap: 8px; }
.changes { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.changes li { padding: 4px 0; border-bottom: 1px solid #f4f4f7; display: flex;
              gap: 8px; align-items: baseline; line-height: 1.45; }
.changes li:last-child { border-bottom: none; }
.changes .op { font-weight: 700; font-size: 10px; text-transform: uppercase;
               letter-spacing: .05em; min-width: 66px; flex: none; }
.changes .op.added { color: #24603d; }
.changes .op.removed { color: #8d3a30; }
.changes .op.relabeled { color: #2b5091; }
.changes .op.moved, .changes .op.resized { color: #55409b; }
.changes .op.restyled { color: #8a6412; }
.changes .op.rewired { color: #1c5f6b; }
.changes .txt { min-width: 0; word-break: break-word; }
.changes del { color: #8d3a30; text-decoration: line-through; opacity: .8; }
.changes ins { color: #24603d; text-decoration: none; }
.changes code { font-family: ui-monospace, Menlo, monospace; font-size: 11px;
                background: #f4f4f7; padding: 1px 4px; border-radius: 3px; }
