/* WP360 dashboard — layout and visual language modelled on the
   MalCare control plane: icon rail, site context panel, breadcrumb top bar,
   card grid, tabbed security view. Branding is WP360's own. */

:root {
  --brand:        #0e9f6e;
  --brand-dark:   #057a55;
  --brand-light:  #def7ec;
  --brand-tint:   #f3faf7;

  --ink:          #111928;
  --ink-2:        #374151;
  --muted:        #6b7280;
  --muted-2:      #9ca3af;

  --line:         #e5e7eb;
  --line-soft:    #f0f2f5;
  --surface:      #ffffff;
  --page:         #f7f8fa;
  --rail:         #ffffff;

  --red:          #e02424;
  --red-bg:       #fdf2f2;
  --amber:        #c27803;
  --amber-bg:     #fdfdea;
  --orange:       #ff5a1f;
  --blue:         #1c64f2;
  --blue-bg:      #ebf5ff;
  --violet:       #7e3af2;

  --r:            10px;
  --r-sm:         7px;
  --shadow:       0 1px 2px rgba(17, 25, 40, .04), 0 1px 3px rgba(17, 25, 40, .06);
  --shadow-lg:    0 4px 14px rgba(17, 25, 40, .07);

  --rail-w:       56px;
  --panel-w:      218px;
  --topbar-h:     52px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

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

h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .4rem; line-height: 1.3; font-weight: 600; }
h1 { font-size: 1.25rem; letter-spacing: -.01em; }
h2 { font-size: 1rem; }
h3 { font-size: .875rem; }

.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.tiny  { font-size: .72rem; }
.nowrap { white-space: nowrap; }

/* ============================ shell ============================ */

.app { display: flex; min-height: 100vh; }

/* --- icon rail --- */
.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .55rem 0;
  gap: .15rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail-logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--brand); border-radius: 9px;
  margin-bottom: .5rem;
}
.rail-logo svg { width: 20px; height: 20px; }

.rail-group {
  font-size: .56rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted-2); margin: .5rem 0 .15rem;
}

.rail a {
  width: 38px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--muted);
  position: relative;
}
.rail a:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.rail a.on { background: var(--brand-light); color: var(--brand-dark); }
.rail a svg { width: 17px; height: 17px; }

/* tooltip on hover, like the collapsed MalCare rail */
.rail a::after {
  content: attr(data-label);
  position: absolute; left: calc(100% + 8px); top: 50%;
  transform: translateY(-50%) scale(.96);
  background: var(--ink); color: #fff;
  font-size: .72rem; padding: .25rem .5rem; border-radius: 5px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 60;
}
.rail a:hover::after { opacity: 1; transform: translateY(-50%) scale(1); }

.rail-spacer { flex: 1 1 auto; }

/* --- site context panel --- */
.panel {
  width: var(--panel-w);
  flex: 0 0 var(--panel-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: .9rem .7rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.panel-label {
  font-size: .6rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted-2); margin: 0 .35rem .4rem;
}
.panel-site {
  padding: .5rem .55rem; border-radius: var(--r-sm);
  background: var(--brand-tint); border: 1px solid var(--brand-light);
  margin-bottom: .9rem;
}
.panel-site b { display: block; color: var(--ink); font-size: .82rem; }
.panel-site span { display: block; font-size: .7rem; color: var(--muted); word-break: break-all; }

.panel nav { display: flex; flex-direction: column; gap: 1px; }
.panel nav a {
  display: flex; align-items: center; gap: .5rem;
  padding: .42rem .55rem; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: .82rem;
}
.panel nav a:hover { background: var(--line-soft); text-decoration: none; }
.panel nav a.on { background: var(--brand); color: #fff; }
.panel nav a.on svg { color: #fff; }
.panel nav a svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 15px; }

.panel-foot { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.panel-foot .who { font-size: .76rem; color: var(--ink); }
.panel-foot .who span { display: block; color: var(--muted); font-size: .7rem; word-break: break-all; }
.panel-foot button {
  margin-top: .45rem; width: 100%;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  padding: .34rem; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-size: .76rem;
}
.panel-foot button:hover { background: var(--line-soft); }

/* --- main column --- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1.1rem;
  position: sticky; top: 0; z-index: 40;
}
.crumbs { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted-2); }
.crumbs .cur { color: var(--ink); font-weight: 500; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.task-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .74rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: .2rem .55rem;
}
.task-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); display: inline-block; }
a.task-chip { color: var(--ink-2); }
a.task-chip:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.task-chip.busy { border-color: var(--brand-light); background: var(--brand-tint); color: var(--brand-dark); }
.task-chip.busy i { background: var(--brand); animation: w360pulse 1.4s ease-in-out infinite; }
@keyframes w360pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.bell {
  position: relative; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--r-sm); color: var(--muted);
}
.bell:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.bell svg { width: 17px; height: 17px; }
.bell.has-unread { color: var(--brand-dark); }
.bell .badge {
  position: absolute; top: 1px; right: 0;
  min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: .6rem; font-weight: 700; line-height: 15px; text-align: center;
}
.rail a .rail-dot {
  position: absolute; top: 5px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 1.5px solid var(--rail);
}

.who-chip { display: flex; align-items: center; gap: .5rem; }
.who-chip .n { font-size: .78rem; color: var(--ink); line-height: 1.15; }
.who-chip .e { font-size: .68rem; color: var(--muted); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 600; font-size: .78rem;
}

.content { padding: 1.1rem 1.25rem 2.5rem; flex: 1 1 auto; }

/* --- page header --- */
.page-head {
  display: flex; align-items: flex-start; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1rem;
}
.page-head .ico {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--brand-light); color: var(--brand-dark);
  display: grid; place-items: center; flex: 0 0 36px;
}
.page-head .ico svg { width: 18px; height: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: .1rem 0 0; font-size: .8rem; color: var(--muted); }
.page-head .acts { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
/* a lone action button sitting directly in the header still right-aligns */
.page-head > .btn, .page-head > form { margin-left: auto; }
.page-head > div > p.mono { font-size: .76rem; }

/* ============================ cards ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: .95rem 1.05rem;
}
.card + .card { margin-top: .85rem; }
.card > :first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .right { margin-left: auto; font-size: .78rem; color: var(--muted); }

.grid  { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.grid-4 { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* stat tile */
.stat { display: flex; flex-direction: column; gap: .1rem; }
.stat b { font-size: 1.45rem; color: var(--ink); font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat span { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* status tile grid, as on MalCare's security summary */
.tiles { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.tile {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .6rem .7rem; display: flex; gap: .55rem; align-items: flex-start;
  background: var(--surface);
}
.tile .ti { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 26px; }
.tile .ti svg { width: 14px; height: 14px; }
.tile .tt { min-width: 0; flex: 1 1 auto; }
.tile .tt b { display: block; font-size: .78rem; color: var(--ink); font-weight: 600; }
.tile .tt span { display: block; font-size: .72rem; color: var(--muted); }
.tile .mark { font-size: .9rem; line-height: 1; }
.ti-ok   { background: var(--brand-light); color: var(--brand-dark); }
.ti-warn { background: var(--amber-bg);    color: var(--amber); }
.ti-bad  { background: var(--red-bg);      color: var(--red); }
.ti-off  { background: var(--line-soft);   color: var(--muted); }

/* big scan-status panel */
.scanbox {
  display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--brand-light); background: var(--brand-tint);
  border-radius: var(--r); padding: 1rem;
}
.scanbox.bad  { border-color: #fbd5d5; background: var(--red-bg); }
.scanbox.warn { border-color: #fce96a; background: var(--amber-bg); }
.scanbox .shield { width: 92px; flex: 0 0 92px; text-align: center; }
.scanbox .shield svg { width: 58px; height: 58px; }
.scanbox .shield b { display: block; font-size: .92rem; letter-spacing: .04em; margin-top: .25rem; }
.scanbox .counts { flex: 1 1 260px; min-width: 0; }
.scanbox .counts .row {
  display: flex; align-items: center; gap: .5rem;
  padding: .22rem 0; font-size: .8rem; border-bottom: 1px dashed rgba(17,25,40,.07);
}
.scanbox .counts .row:last-child { border-bottom: 0; }
.scanbox .counts .row .n { font-weight: 600; color: var(--ink); min-width: 1.6rem; }
.scanbox .counts .row .lbl { flex: 1 1 auto; }

.c-ok   { color: var(--brand-dark); }
.c-bad  { color: var(--red); }
.c-warn { color: var(--amber); }

/* ============================ tabs ============================ */

.tabs {
  display: flex; gap: .15rem; border-bottom: 1px solid var(--line);
  margin-bottom: .95rem; overflow-x: auto;
}
.tabs a {
  padding: .5rem .8rem; font-size: .83rem; color: var(--muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }

/* ============================ table ============================ */

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); font-weight: 600; background: var(--line-soft);
  position: sticky; top: 0;
}
tbody tr:hover { background: #fcfdfd; }
tr:last-child td { border-bottom: 0; }
td.mono { font-size: .76rem; word-break: break-all; }

/* site row, as on Manage Sites */
.site-cell { display: flex; gap: .6rem; align-items: center; min-width: 0; }
.thumb {
  width: 56px; height: 40px; flex: 0 0 56px; border-radius: 5px;
  background: var(--line-soft); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: .54rem; color: var(--muted-2);
  text-align: center; line-height: 1.15; padding: 2px;
}
.site-cell .nm { min-width: 0; }
.site-cell .nm b { display: block; color: var(--ink); font-size: .84rem; }
.site-cell .nm a.dom { font-size: .74rem; color: var(--brand-dark); word-break: break-all; }

/* ============================ bits ============================ */

.pill {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .12rem .45rem; border-radius: 5px;
  font-size: .69rem; font-weight: 600; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.pill-ok       { background: var(--brand-light); color: var(--brand-dark); border-color: #bcf0da; }
.pill-pending  { background: var(--line-soft);   color: var(--muted);      border-color: var(--line); }
.pill-guess    { background: var(--line-soft);   color: var(--muted);      border-color: var(--line); }
.pill-proof    { background: var(--blue-bg);     color: #1a56db;           border-color: #c3ddfd; }
.pill-error    { background: var(--red-bg);      color: var(--red);        border-color: #fbd5d5; }
.pill-critical { background: var(--red-bg);      color: #9b1c1c;           border-color: #f8b4b4; }
.pill-high     { background: #fff8f1;            color: #b43403;           border-color: #fdba8c; }
.pill-medium   { background: var(--amber-bg);    color: var(--amber);      border-color: #fce96a; }
.pill-low      { background: var(--blue-bg);     color: #1a56db;           border-color: #c3ddfd; }

.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  padding: .42rem .8rem; border-radius: var(--r-sm);
  font-size: .81rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); text-decoration: none; color: #fff; }
.btn svg { width: 14px; height: 14px; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); border-color: var(--muted-2); }
.btn-danger { background: var(--surface); color: var(--red); border-color: #f8b4b4; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.btn-sm { padding: .28rem .55rem; font-size: .75rem; }

.acts { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }

.notice { border-radius: var(--r-sm); padding: .6rem .75rem; font-size: .82rem; margin-bottom: .85rem; }
.notice-error { background: var(--red-bg);   border: 1px solid #fbd5d5; color: #9b1c1c; }
.notice-warn  { background: var(--amber-bg); border: 1px solid #fce96a; color: #8e4b10; }
.notice-info  { background: var(--blue-bg);  border: 1px solid #c3ddfd; color: #1e429f; }
.notice-ok    { background: var(--brand-tint); border: 1px solid #bcf0da; color: var(--brand-dark); }

pre.block {
  background: #fbfcfc; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: .6rem; overflow: auto; font-size: .74rem; margin: 0; max-height: 260px;
}

.empty { padding: 2.2rem 1rem; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); }

/* ============================ filters ============================ */

.withside { display: grid; grid-template-columns: 228px 1fr; gap: .85rem; align-items: start; }
.side .card { padding: .8rem .85rem; }
.side h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); }
.chiprow { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip {
  font-size: .72rem; padding: .22rem .5rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ============================ forms ============================ */

.field { margin-bottom: .75rem; }
.field label { display: block; font-size: .75rem; font-weight: 600; color: var(--ink-2); margin-bottom: .25rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .46rem .55rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: .84rem; background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand-light); border-color: var(--brand);
}
.field .help { font-size: .73rem; color: var(--muted); margin-top: .2rem; }
.inline-input {
  flex: 1 1 240px; padding: .42rem .55rem;
  border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit; font-size: .82rem;
}

/* ============================ auth ============================ */

.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--surface); }
.auth-form > div { width: 100%; max-width: 352px; }
.auth .eyebrow {
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brand-dark); font-weight: 700; margin-bottom: .35rem;
}
.auth h1 { font-size: 1.6rem; }
.auth-aside {
  background: #0b1a2b; color: #cbd5e1; padding: 3rem 2.5rem;
  display: flex; flex-direction: column; justify-content: center; gap: 1.1rem;
}
.auth-aside h2 { color: #fff; font-size: 1.35rem; }
.auth-aside ul { margin: 0; padding-left: 1.05rem; font-size: .86rem; }
.auth-aside li { margin-bottom: .5rem; }
.auth-aside strong { color: #fff; }
.auth-mark { display: flex; align-items: center; gap: .55rem; margin-bottom: .4rem; }
.auth-mark .m { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.auth-mark .m svg { width: 17px; height: 17px; }
.auth-mark b { color: var(--ink); font-size: .95rem; display: block; line-height: 1.1; }
.auth-mark span { font-size: .6rem; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }

/* ============================ responsive ============================ */

@media (max-width: 1080px) {
  .withside { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .rail {
    width: auto; flex: none; height: auto; position: static;
    flex-direction: row; justify-content: flex-start;
    overflow-x: auto; padding: .4rem .5rem; gap: .25rem;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .rail-group, .rail-spacer { display: none; }
  .rail a::after { display: none; }
  .panel {
    width: auto; flex: none; height: auto; position: static;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .panel nav { flex-direction: row; flex-wrap: wrap; }
  .content { padding: .9rem; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
