/* sip-provision admin UI — light theme matching the SIPfonica robot artwork:
   the photo's light-gray backdrop with a darker-gray accent (flat, hairlines). */
* { box-sizing: border-box; }
:root {
  --bg: #e7e7e7;          /* the photo's gray backdrop */
  --panel: #ffffff;       /* cards sit above the gray */
  --panel-2: #f1f1f2;     /* table head / panel head */
  --panel-3: #ececed;     /* hover / inputs */
  --line: #d8d9dc;        /* hairline border */
  --line-2: #c5c7cb;      /* slightly stronger */
  --fg: #1d2025;
  --fg-dim: #4c525b;
  --muted: #838893;
  /* darker-gray accent (graphite) */
  --accent: #565c64;
  --accent-hi: #454a52;   /* hover = darker */
  --accent-fg: #ffffff;   /* white ink on the gray accent */
  --accent-dim: rgba(86, 92, 100, 0.14);
  --good: #1f9d57;  --good-bg: rgba(31, 157, 87, 0.12);
  --bad:  #d23b3b;  --bad-bg:  rgba(210, 59, 59, 0.10);
  --warn: #b1740d;  --warn-bg: rgba(177, 116, 13, 0.13);
  --radius: 8px;
  --radius-sm: 6px;
}

html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* ---- flat icons ---- */
.ic {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  flex: none; vertical-align: -2px;
}

/* ---- top bar ---- */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  height: 56px; padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
/* robot app-icon used as the product logo */
.logo-img {
  width: 30px; height: 30px; border-radius: 8px;
  object-fit: cover; display: block;
  border: 1px solid var(--line-2);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
.logo-img.lg {
  width: 76px; height: 76px; border-radius: 20px;
  margin: 0 auto 16px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 0 0 5px var(--accent-dim);
}
header nav { display: flex; gap: 18px; align-items: center; font-size: 13px; }
#who { color: var(--muted); }
.navlink { display: inline-flex; align-items: center; gap: 7px; color: var(--fg-dim); text-decoration: none; }
.navlink:hover { color: var(--fg); }

/* ---- layout ---- */
main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
h3 {
  margin: 0; font-size: 12px; font-weight: 650; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--fg-dim);
  display: inline-flex; align-items: center; gap: 8px;
}
h3 .ic { width: 15px; height: 15px; color: var(--muted); }
.muted { color: var(--muted); }
.sub { margin: 5px 0 0; font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }

/* ---- panels (clearly defined sections) ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: 0 1px 2px rgba(20, 24, 30, 0.05);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th {
  background: var(--panel-2);
  font-weight: 600; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
th.num, td.num { text-align: center; width: 1%; white-space: nowrap; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--panel-3); }
.actions-cell { width: 1%; white-space: nowrap; text-align: right; }
.actions-cell .btn + .btn { margin-left: 6px; }
td .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---- buttons ---- */
.btn {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--panel-3); border-color: var(--line-2); }
.btn .ic { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.danger { color: var(--bad); border-color: var(--line-2); background: transparent; }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; padding: 10px; }

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

/* ---- pills (flat) ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.on   { background: var(--good-bg); color: var(--good); }
.pill.off  { background: var(--bad-bg);  color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.neutral { background: var(--panel-3); color: var(--fg-dim); }
.pill.bare { background: var(--panel-3); color: var(--fg-dim); }
.pill.bare::before { display: none; }

/* ---- call direction ---- */
.dir { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 12.5px; }
.dir .ic { width: 15px; height: 15px; }
.dir.in  { color: var(--good); }
.dir.out { color: var(--accent); }

/* ---- switch (flat) ---- */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 36px; height: 20px; border-radius: 11px;
  background: var(--panel-3); border: 1px solid var(--line-2);
  position: relative; transition: background .15s, border-color .15s; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--fg-dim); transition: transform .16s, background .16s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-dim); }

/* ---- detail header ---- */
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.crumb:hover { color: var(--fg); text-decoration: none; }
.crumb .ic { width: 16px; height: 16px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-head h2 { font-size: 21px; }
.detail-head .muted { margin-top: 3px; }

/* ---- stat cards ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; box-shadow: 0 1px 2px rgba(20, 24, 30, 0.05); }
.stat .k { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .k .ic { width: 14px; height: 14px; }
.stat .v { font-size: 15px; font-weight: 600; margin-top: 8px; }
.stat .v .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.stat .x { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---- pagination ---- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--panel-2); border-top: 1px solid var(--line);
}
.pager-info { font-size: 12px; color: var(--muted); }
.pager-ctrl { display: flex; align-items: center; gap: 4px; }
.pg {
  min-width: 30px; height: 30px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); color: var(--fg-dim);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.pg:hover:not(:disabled):not(.active) { background: var(--panel-3); color: var(--fg); }
.pg.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); cursor: default; }
.pg:disabled { opacity: 0.4; cursor: not-allowed; }
.pg.gap { border: 0; background: none; cursor: default; color: var(--muted); min-width: 18px; }
.pg .ic { width: 16px; height: 16px; }

/* ---- empty state ---- */
.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { color: var(--fg-dim); font-weight: 600; }

/* ---- dialog ---- */
dialog {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 22px 24px;
  min-width: 420px; max-width: 92vw;
  box-shadow: 0 12px 40px rgba(20, 24, 30, 0.18);
}
dialog::backdrop { background: rgba(30, 34, 40, 0.34); }
dialog h3 { margin: 0 0 14px; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--fg); }
dialog label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
dialog input, dialog select, dialog textarea {
  width: 100%; padding: 9px 11px; margin-bottom: 12px;
  background: var(--panel-3); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit;
}
dialog textarea { resize: vertical; min-height: 60px; }
dialog input:focus, dialog select:focus, dialog textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 8px 0 0; }
dialog button {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--fg); cursor: pointer; font-size: 13px; font-weight: 500;
}
dialog button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* ---- login card ---- */
#login-card {
  max-width: 420px; margin: 72px auto; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 4px 16px rgba(20, 24, 30, 0.07);
}
#login-card h2 { margin-bottom: 8px; }
#login-card p { color: var(--muted); margin: 8px 0 20px; }

/* ---- top tabs ---- */
.tabs { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--muted); padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.tab .ic { width: 15px; height: 15px; }
.tab:hover { color: var(--fg); background: var(--panel-3); }
.tab.active { color: var(--fg); background: var(--accent-dim); border-color: var(--line-2); }

/* ---- header select (company assignment) ---- */
.hsel {
  background: var(--panel-2); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 7px 10px; font: inherit; font-size: 13px; max-width: 220px;
}
.hsel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ---- section head (call groups list) ---- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }

/* ---- call group cards ---- */
.group-name { font-size: 14px; font-weight: 650; display: inline-flex; align-items: center; gap: 8px; color: var(--fg); }
.group-name .ic { width: 16px; height: 16px; color: var(--muted); }
.gh-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---- presence pills ---- */
.pill.busy { background: var(--bad-bg);  color: var(--bad); }
.pill.free { background: var(--good-bg); color: var(--good); }
.pill.offline { background: var(--panel-3); color: var(--muted); }

/* ---- responsive ---- */
@media (max-width: 720px) {
  main { padding: 18px 14px 48px; }
  header { padding: 0 16px; gap: 8px; }
  .tab { padding: 6px 9px; }
  th, td { padding: 10px 12px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .pager { flex-direction: column; align-items: stretch; gap: 8px; }
  .pager-info { text-align: center; }
  .pager-ctrl { justify-content: center; }
}
