/* Account Management — same visual language as /phone. Blue accent, boxy. */

:root {
  --blue:        #006496;
  --blue-dark:   #004d73;
  --blue-light:  #3498db;
  --text:        #2c2c2c;
  --muted:       #6b6b6b;
  --bg:          #f5f5f5;
  --card:        #ffffff;
  --border:      #dddddd;
  --row-hover:   #fafafa;
  --error-bg:    #f8d7da;
  --error-bd:    #f5c6cb;
  --error-fg:    #721c24;
  --warn-bg:     #fff3cd;
  --warn-bd:     #ffeeba;
  --warn-fg:     #856404;
  --success-fg:  #155724;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted  { color: var(--muted); }
.small  { font-size: 12px; }
.mono   { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.spacer { flex: 1; }
.error-fg { color: var(--error-fg); }

/* ---------- Nav ---------- */

.main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 50px;
  background-color: var(--blue);
  color: white;
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 600; color: inherit; text-decoration: none;
}
.nav-brand:hover { text-decoration: none; }
.nav-logo { height: 30px; width: auto; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-user {
  color: #cfe7f4; font-size: 13px; padding: 5px 10px;
  border-left: 1px solid var(--blue-dark);
}
.nav-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  border: 1px solid rgba(255,255,255,0.5); padding: 2px 6px; border-radius: 3px;
}
.nav-logout-form { margin: 0; }
.nav-logout {
  background: transparent; color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 12px; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.nav-logout:hover { background-color: var(--blue-dark); }

/* ---------- Layout ---------- */

.main-content { max-width: 1400px; margin: 20px auto 40px; padding: 0 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.notice {
  border-radius: 4px;
  padding: 10px 12px;
  margin: 0 0 14px;
  font-size: 13px;
}
.notice-warn { background: var(--warn-bg); border: 1px solid var(--warn-bd); color: var(--warn-fg); }

/* ---------- Config strip ---------- */

.config-strip {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.pill {
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
}
.pill-on  { border-color: #bcdcc4; color: var(--success-fg); background: #eef8f0; }
.pill-off { border-color: var(--warn-bd); color: var(--warn-fg); background: var(--warn-bg); }
.pill-quiet { color: var(--muted); }

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.tabs { display: flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.tab {
  border: none; background: var(--card); padding: 7px 14px;
  font: inherit; font-size: 13px; cursor: pointer; color: var(--text);
  border-right: 1px solid var(--border);
}
.tab:last-child { border-right: none; }
.tab.active { background: var(--blue); color: white; }
.count {
  display: inline-block; min-width: 18px; margin-left: 6px;
  font-size: 11px; color: inherit; opacity: 0.75;
}
.count-warn { color: var(--error-fg); font-weight: 600; opacity: 1; }
.tab.active .count-warn { color: #ffd8d8; }

/* ---------- Inputs ---------- */

.input {
  font: inherit; font-size: 13px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 4px; background: white;
  color: var(--text); width: 100%;
}
.input:focus { outline: 2px solid var(--blue-light); outline-offset: -1px; }
#search { max-width: 260px; }

.field { display: flex; flex-direction: column; gap: 4px; flex: 1; font-size: 13px; }
.field > span:first-child { font-weight: 600; }
.field-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 5px 0; cursor: pointer;
}
.check input { margin: 0; }
.check-grid { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 500;
  background: white; color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #f3f3f3; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-danger { background: #e74c3c; border-color: #e74c3c; color: white; }
.btn-danger:hover:not(:disabled) { background: #c0392b; border-color: #c0392b; }
.btn-xs { padding: 3px 9px; font-size: 12px; }

/* ---------- Table (Tabulator, themed to match) ---------- */

.tabulator {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}
.tabulator .tabulator-header {
  background: #fbfbfb;
  border-bottom: 1px solid var(--border);
}
.tabulator .tabulator-header .tabulator-col {
  background: #fbfbfb;
  border-right: none;
}
.tabulator .tabulator-header .tabulator-col-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 600;
}
.tabulator-row { border-bottom: 1px solid #eee; }
.tabulator-row.tabulator-row-even { background: var(--card); }
.tabulator-row:hover { background: var(--row-hover) !important; }
.tabulator .tabulator-row .tabulator-cell {
  border-right: none;
  padding: 9px 12px;
  /* Rows size to their content: names, tags and buttons all fit rather than
     being clipped at a fixed height. */
  height: auto;
  white-space: normal;
}
.tabulator .tabulator-row .tabulator-cell.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;   /* long ExRemoved-… addresses wrap instead of pushing */
}
.tabulator-row .tabulator-cell.tabulator-frozen { background: inherit; }
.tabulator .tabulator-footer { display: none; }
.tabulator .tabulator-placeholder .tabulator-placeholder-contents {
  color: var(--muted); font-size: 13px;
}

.name-cell .name-main { font-weight: 500; }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; align-items: center; }

.flag { font-weight: 700; }
.flag-yes { color: #1f9d55; }
.flag-no  { color: #c9c9c9; }

.tag-locked { background: #eef2f5; color: var(--blue-dark); border-color: #bcd4e2; }

.tag {
  margin-left: 8px; font-size: 11px; padding: 1px 6px; border-radius: 3px;
  background: #eef2f5; color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap;
}

/* Issue lines sit under the row they belong to. The row is a flex container,
   so a full-width child wraps onto its own line and spans every column. */
.tabulator-row { flex-wrap: wrap; }
.issue-holder { width: 100%; }
.issue-holder:empty { display: none; }
.issue-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--warn-bg); color: var(--warn-fg);
  border-top: 1px solid var(--warn-bd);
  padding: 6px 12px; font-size: 12px;
}
.warn-dot {
  display: inline-block; width: 16px; height: 16px; line-height: 16px;
  text-align: center; border-radius: 50%; background: var(--warn-fg);
  color: var(--warn-bg); font-size: 11px; font-weight: 700; flex: none;
}

.empty { text-align: center; color: var(--muted); padding: 24px 12px; }

/* The admins page keeps a plain table — three rows need no grid engine. */
.grid { width: 100%; border-collapse: collapse; }
.grid th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: #fbfbfb;
}
.grid td { padding: 8px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.grid tr:hover td { background: var(--row-hover); }
.col-actions { text-align: right; white-space: nowrap; }

/* ---------- Admins page / access gate ---------- */

.nav-tab {
  color: white; font-size: 13px; padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.4); border-radius: 4px; text-decoration: none;
}
.nav-tab:hover { background: var(--blue-dark); text-decoration: none; }
.nav-tab.active { background: var(--blue-dark); }

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; }

.section-head {
  margin: 24px 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}

.add-admin { display: flex; gap: 8px; align-items: center; }
.add-admin .input { max-width: 340px; }

.gate {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 28px; max-width: 560px; margin: 40px auto;
}
.gate h1 { margin: 0 0 12px; font-size: 20px; font-weight: 600; }
.gate p { margin: 0 0 12px; font-size: 14px; }
.gate form { margin-top: 18px; }

/* ---------- Modals ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 5px; width: 100%; max-width: 520px;
  border: 1px solid var(--border);
}
.modal-wide { max-width: 720px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
  border: none; background: none; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--muted);
}
.modal-body { padding: 18px; }
.modal-body h3 {
  margin: 18px 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.modal-body h3:first-child { margin-top: 0; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border); background: #fbfbfb;
}
.error-inline { flex: 1; color: var(--error-fg); font-size: 12px; }

.plain-list { margin: 8px 0 12px; padding-left: 20px; }
.plain-list li { margin: 2px 0; }

.precheck { min-height: 20px; margin-bottom: 4px; }

.realm-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 13px;
}
.realm-row > span:first-child { font-weight: 600; }
#qRealm { flex: 1; color: var(--muted); }
#qList .field { margin-bottom: 12px; }

/* A role that isn't offered in the dropdown — shown, not editable. */
.role-fixed {
  padding: 7px 10px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  background: #fbfbfb;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Job steps ---------- */

.steps { list-style: none; margin: 0; padding: 0; }
.step {
  padding: 7px 0 7px 26px; position: relative;
  border-bottom: 1px solid #f0f0f0; font-size: 13px;
}
.step:last-child { border-bottom: none; }
.step-icon { position: absolute; left: 0; top: 7px; width: 20px; text-align: center; }
.step-pending { color: var(--muted); }
.step-running { font-weight: 600; }
.step-running .step-icon { color: var(--blue); }
.step-done .step-icon { color: #1f9d55; }
.step-skipped { color: var(--muted); }
.step-failed { color: var(--error-fg); }

.password-box {
  margin-top: 14px; padding: 10px 12px;
  background: #eef8f0; border: 1px solid #bcdcc4; border-radius: 4px; font-size: 13px;
}

.error-message {
  background: var(--error-bg); border: 1px solid var(--error-bd);
  color: var(--error-fg); padding: 10px 12px; border-radius: 4px;
  font-size: 13px; margin-top: 12px;
}

/* ---------- Login ---------- */

.login-body { background: var(--bg); }
.login-container { display: flex; justify-content: center; padding: 60px 20px 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; width: 100%; max-width: 420px;
}
.login-header { padding: 24px 28px 16px; border-bottom: 1px solid var(--border); }
.login-header h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.login-header p { margin: 0; color: var(--muted); font-size: 13px; }
.login-body-inner { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.login-info { margin: 0; color: var(--muted); font-size: 13px; }
.btn-microsoft {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 24px; background: #2f2f2f; color: white; border: none;
  border-radius: 4px; text-decoration: none; font-size: 14px; font-weight: 500;
}
.btn-microsoft:hover { background: #1a1a1a; text-decoration: none; }
.login-footer {
  padding: 14px 28px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted); text-align: center;
}
