
:root{
  --ui-bg:#f3f6f8;--ui-surface:#fff;--ui-soft:#f8fafb;--ui-line:#dfe7ec;
  --ui-ink:#173244;--ui-ink2:#566f80;--ui-muted:#7a909f;--ui-accent:#0f7fa7;
  --ui-accent-soft:#e7f5fa;--ui-good:#188766;--ui-good-soft:#eaf7f2;--ui-bad:#b74e4e;
  --ui-shadow:0 10px 28px rgba(32,58,73,.065);
}

body{
  background:var(--ui-bg)!important;
  color:var(--ui-ink)!important;
  font-size:16px!important;
}
.monitoring-shell{background:var(--ui-bg)!important}
.monitoring-topbar,.topbar{
  background:#fff!important;border-color:var(--ui-line)!important;box-shadow:0 4px 18px rgba(32,58,73,.04)!important
}
.monitoring-topbar h1,.monitoring-topbar strong{color:var(--ui-ink)!important}
.monitoring-topbar span{color:var(--ui-ink2)!important}

.global-nav{
  background:#fff!important;border-color:var(--ui-line)!important;box-shadow:0 6px 22px rgba(32,58,73,.04)!important
}
.global-nav-item{color:var(--ui-ink2)!important;font-size:.82rem!important}
.global-nav-item.active{color:var(--ui-accent)!important;background:var(--ui-accent-soft)!important}

.monitoring-main{max-width:1500px;margin:0 auto!important;padding-top:26px!important}
.monitor-stat,.console-card{
  background:#fff!important;border-color:var(--ui-line)!important;box-shadow:var(--ui-shadow)!important
}
.monitor-stat span,.card-label,.eyebrow{color:var(--ui-muted)!important}
.monitor-stat strong,.console-card h2,.console-card h3,.console-card h4,.section-heading-row h2{color:var(--ui-ink)!important}
.monitor-stat small,.section-heading-row p,.console-card p{color:var(--ui-ink2)!important}
.monitor-good strong{color:var(--ui-good)!important}

.admin-v58{gap:18px!important}
.admin-hero{
  display:flex;justify-content:space-between;align-items:flex-end;gap:20px;padding:6px 2px 2px
}
.admin-hero h2{margin:6px 0 0;color:var(--ui-ink);font-size:1.8rem}
.admin-hero p{margin:7px 0 0;max-width:760px;color:var(--ui-ink2);line-height:1.55}
.backend-badge{
  flex:0 0 auto;padding:9px 12px;border-radius:999px;background:var(--ui-accent-soft);
  color:var(--ui-accent);font-size:.72rem;font-weight:850;border:1px solid #cce8f2
}
.backend-badge.ok{background:var(--ui-good-soft);color:var(--ui-good);border-color:#d3eadf}
.backend-badge.bad{background:#fff0f0;color:var(--ui-bad);border-color:#f0d5d5}
.backend-warning{
  display:flex;align-items:center;gap:10px;padding:14px 16px;background:#fff4e8;border:1px solid #f0d7b7;
  border-radius:12px;color:#8b5b19
}
.backend-warning[hidden]{display:none!important}

.admin-tabs{
  display:flex;gap:7px;padding:6px;background:#fff;border:1px solid var(--ui-line);
  border-radius:14px;box-shadow:0 6px 20px rgba(32,58,73,.035);overflow-x:auto
}
.admin-tab{
  min-height:43px;padding:9px 15px;border:0;border-radius:10px;background:transparent;
  color:var(--ui-ink2);font-size:.86rem;font-weight:800;cursor:pointer;white-space:nowrap
}
.admin-tab.active{background:var(--ui-accent-soft);color:var(--ui-accent)}

.admin-panel{
  display:none;background:#fff;border:1px solid var(--ui-line);border-radius:18px;
  box-shadow:var(--ui-shadow);padding:24px
}
.admin-panel.active{display:block}
.admin-panel-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:18px}
.admin-panel-heading>div{display:flex;align-items:center;gap:12px}
.admin-panel-heading h3{margin:0;color:var(--ui-ink);font-size:1.25rem}
.admin-panel-heading p{margin:4px 0 0;color:var(--ui-ink2);font-size:.88rem}
.step-number{
  display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:var(--ui-accent-soft);
  color:var(--ui-accent);font-size:.72rem;font-weight:900
}

.friendly-form{
  display:grid;grid-template-columns:1.2fr 1.4fr 1.2fr auto;gap:12px;align-items:end;
  padding:16px;background:var(--ui-soft);border:1px solid var(--ui-line);border-radius:14px;margin-bottom:18px
}
.friendly-form.four{grid-template-columns:repeat(4,minmax(150px,1fr)) auto}
.friendly-form.rule-grid{grid-template-columns:repeat(4,minmax(150px,1fr))}
.friendly-form.schedule-grid{grid-template-columns:repeat(4,minmax(150px,1fr))}
.friendly-form label,.assignment-card label{display:grid;gap:6px}
.friendly-form label>span,.assignment-card label>span{
  color:var(--ui-muted);font-size:.72rem;font-weight:800;letter-spacing:.02em
}
.friendly-form input,.friendly-form select,.assignment-card input,.assignment-card select{
  width:100%;min-height:44px;padding:10px 11px;border:1px solid #ccd9e1;border-radius:10px;
  background:#fff;color:var(--ui-ink);font-size:.88rem;outline:none
}
.friendly-form input:focus,.friendly-form select:focus,.assignment-card select:focus{
  border-color:#7cc0db;box-shadow:0 0 0 3px rgba(15,127,167,.08)
}
.primary-action{
  min-height:44px;padding:10px 15px;border:0;border-radius:10px;background:var(--ui-accent);
  color:#fff;font-size:.84rem;font-weight:850;cursor:pointer
}
.primary-action:hover{filter:brightness(.96)}

.data-card{border:1px solid var(--ui-line);border-radius:14px;overflow:hidden;background:#fff}
.data-card-title{display:flex;justify-content:space-between;align-items:center;padding:14px 16px;background:#fbfcfd;border-bottom:1px solid var(--ui-line)}
.data-card-title h4{margin:0;color:var(--ui-ink)}
.data-card-title span{color:var(--ui-muted);font-size:.78rem}

.console-table{font-size:.85rem!important}
.console-table th{background:#f8fafb!important;color:var(--ui-muted)!important;font-size:.72rem!important}
.console-table td{color:var(--ui-ink2)!important}
.console-table td strong{display:block;color:var(--ui-ink)!important}
.console-table td small{display:block;margin-top:2px;color:var(--ui-muted)!important;font-size:.74rem!important}

.status-chip,.severity-chip{
  display:inline-flex;padding:5px 8px;border-radius:999px;font-size:.68rem;font-weight:850
}
.status-chip.enabled{color:var(--ui-good);background:var(--ui-good-soft)}
.status-chip.disabled{color:var(--ui-muted);background:#eef2f4}
.severity-chip{color:#8b5b19;background:#fff2da}

.small-action{
  min-height:32px!important;padding:6px 9px!important;background:#eef6f9!important;color:var(--ui-accent)!important;
  border:1px solid #d5e8ef!important;font-size:.7rem!important
}
.small-action.danger,.text-danger{
  color:var(--ui-bad)!important;background:#fff2f2!important;border:1px solid #f0d7d7!important
}
.text-danger{padding:7px 9px;border-radius:9px;cursor:pointer;font-size:.7rem;font-weight:800}

.empty-friendly{padding:26px;text-align:center;color:var(--ui-muted);font-size:.88rem}

.group-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(235px,1fr));gap:12px;padding:14px}
.group-card{
  display:grid;gap:12px;padding:16px;border:1px solid var(--ui-line);border-radius:13px;background:#fff
}
.group-card h4{margin:5px 0 0;color:var(--ui-ink)}
.group-card p{margin:3px 0 0;color:var(--ui-muted);font-size:.78rem}
.group-code{display:inline-flex;padding:5px 8px;border-radius:999px;background:var(--ui-accent-soft);color:var(--ui-accent);font-size:.7rem;font-weight:900}
.group-stats{display:flex;gap:16px}
.group-stats span{color:var(--ui-muted);font-size:.76rem}.group-stats strong{color:var(--ui-ink)}

.assignment-columns{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px}
.assignment-card{
  display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:18px;border:1px solid var(--ui-line);
  border-radius:14px;background:var(--ui-soft)
}
.assignment-card>div:first-child{grid-column:1/-1}
.assignment-card h4{margin:0;color:var(--ui-ink)}
.assignment-card p{margin:4px 0 0;color:var(--ui-ink2);font-size:.84rem}
.permission-list{grid-column:1/-1;display:flex;gap:14px;flex-wrap:wrap;padding:8px 0}
.permission-list label{display:flex;align-items:center;gap:6px;color:var(--ui-ink2);font-size:.8rem}

.rule-list,.schedule-list{display:grid}
.rule-row,.schedule-row{
  display:grid;grid-template-columns:minmax(220px,1.5fr) minmax(220px,1fr) auto auto;
  gap:14px;align-items:center;padding:14px 16px;border-bottom:1px solid var(--ui-line)
}
.rule-row:last-child,.schedule-row:last-child{border-bottom:0}
.rule-row div:first-child strong,.schedule-row strong{display:block;color:var(--ui-ink)}
.rule-row div:first-child span,.schedule-row span{display:block;margin-top:3px;color:var(--ui-muted);font-size:.75rem}
.rule-condition{color:var(--ui-ink2);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.78rem}
.schedule-row{grid-template-columns:1.2fr 1.2fr 1.2fr auto auto}

.monitoring-summary{gap:14px!important}
.monitor-stat{padding:20px!important}
.monitor-stat strong{font-size:2rem!important}
.monitor-stat span{font-size:.72rem!important}
.monitor-stat small{font-size:.8rem!important}

@media(max-width:1100px){
  .friendly-form,.friendly-form.four,.friendly-form.rule-grid,.friendly-form.schedule-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .assignment-columns{grid-template-columns:1fr}
  .rule-row,.schedule-row{grid-template-columns:1fr}
}
@media(max-width:700px){
  .friendly-form,.friendly-form.four,.friendly-form.rule-grid,.friendly-form.schedule-grid{grid-template-columns:1fr}
  .admin-panel{padding:16px}
  .admin-hero,.admin-panel-heading{align-items:flex-start;flex-direction:column}
}
