/* OfferHub — DMS Partner Platform look:
   dark icon rail + white flyout menu + navy/blue content on white. */

:root {
    /* Addrawtech Ads brand: teal from the AA monogram */
    --brand: #1a607a;
    --brand-dark: #144b60;
    --rail: #0e2f3d;          /* deep teal icon rail */
    --rail-ink: #b9cdd6;
    --navy: #144b60;          /* dark buttons, auth card panel */
    --ink: #1f4457;           /* headings */
    --text: #35505f;
    --muted: #7b909c;
    --link: #1a607a;
    --lime: #1a607a;        /* accent = Addrawtech teal (was DMS lime) */
    --tip-ink: #ffffff;
    --bg: #fbfcfe;
    --panel: #ffffff;
    --panel-h: #eef1f6;       /* panel header band */
    --line: #dfe5ec;
    --line-soft: #ecf0f5;
    --ok: #21a453; --ok-bg: #e2f5e9;
    --warn: #a3720a; --warn-bg: #fbf0d3;
    --bad: #c22f2f; --bad-bg: #fbe3e3;
}

* { box-sizing: border-box; margin: 0; }
body { font: 14px/1.5 "Nunito Sans", "Segoe UI", -apple-system, Roboto, sans-serif;
       background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------ shell/rail */
.shell { display: flex; min-height: 100vh; }

.rail { width: 62px; flex-shrink: 0; background: var(--rail); color: var(--rail-ink);
        display: flex; flex-direction: column; align-items: center; gap: 8px;
        padding: 12px 0; position: sticky; top: 0; height: 100vh; z-index: 90; }
.rail a, .rail button { width: 42px; height: 42px; display: flex; align-items: center;
        justify-content: center; border-radius: 10px; color: var(--rail-ink);
        background: none; border: 0; cursor: pointer; position: relative; }
.rail a:hover, .rail button:hover { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.rail a.active { background: #1a607a; color: #fff; }
.rail svg { width: 21px; height: 21px; }
.rail .spacer { flex: 1; }
.rail hr { width: 26px; border: 0; border-top: 1px solid rgba(255,255,255,.16); margin: 4px 0; }

/* Everflow-style lime tooltip callouts */
.rail a::after, .rail button::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%;
    transform: translateY(-50%); background: var(--brand); color: var(--tip-ink);
    font: 700 12px/1 "Nunito Sans", sans-serif; letter-spacing: .18em; text-transform: uppercase;
    padding: 12px 18px; white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity .12s ease; z-index: 80; }
.rail a::before, .rail button::before {
    content: ""; position: absolute; left: calc(100% + 2px); top: 50%;
    transform: translateY(-50%); border: 6px solid transparent;
    border-right-color: var(--brand); opacity: 0; transition: opacity .12s ease; z-index: 80; }
.rail a:hover::after, .rail button:hover::after,
.rail a:hover::before, .rail button:hover::before { opacity: 1; }

/* ------------------------- white overlay drawer: Everflow floating card */
.sidebar { background: var(--panel); position: fixed; left: 76px; top: 14px; bottom: 14px;
           z-index: 70; border-radius: 14px; box-shadow: 0 10px 34px rgba(20,40,60,.13);
           border: 1px solid var(--line);
           transform: translateX(-120%); transition: transform .16s ease; visibility: hidden;
           overflow: hidden; }
body.nav-open .sidebar { transform: none; visibility: visible; }
.drawer { display: flex; height: 100%; }
.side-col { width: 252px; overflow-y: auto; padding-bottom: 14px; }
.sub-col { width: 380px; border-left: 1px solid var(--line); overflow-y: auto;
           padding: 22px 20px 20px; display: none; }
.sidebar.sub-open .sub-col.on { display: block; }
.side-close { position: absolute; top: 16px; right: 18px; background: none; border: 0;
              font-size: 20px; color: var(--muted); cursor: pointer; padding: 4px 8px; z-index: 2; }
.side-close:hover { color: var(--ink); }

/* submenu column (Reporting) */
.sub-h { display: flex; align-items: center; gap: 10px; font-size: 16.5px; font-weight: 700;
         color: var(--ink); margin: 2px 6px 12px; }
.sub-h svg { width: 19px; height: 19px; opacity: .75; }
.sub-item { display: block; padding: 9px 13px; border-radius: 7px; margin-bottom: 1px; }
.sub-item:hover { background: #f1f6f8; text-decoration: none; }
.sub-item .sub-t { font-size: 14px; font-weight: 600; color: var(--ink); }
.sub-item .sub-d { font-size: 12.5px; color: #74849a; margin-top: 1px; font-weight: 400; }

.side-brand { padding: 26px 22px 12px; text-align: center; }
.brand-mark { display: inline-flex; align-items: center; gap: 9px; font-size: 21px;
              font-weight: 800; color: var(--navy); letter-spacing: -.01em; }
.brand-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
             display: inline-flex; align-items: center; justify-content: center;
             color: #fff; font-size: 14px; font-weight: 800; }
.brand-img { max-width: 200px; max-height: 96px; display: inline-block; object-fit: contain; }
.auth-card .brand-img { max-height: 130px; max-width: 260px; margin-bottom: 14px; }
.side-sub { display: flex; align-items: center; gap: 10px; color: #9aa6b4;
            font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; margin-top: 10px; font-weight: 600; }
.side-sub::before, .side-sub::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.side-nav { padding: 4px 16px 18px; }
.side-group { font-size: 10.5px; font-weight: 600; color: #97a3b2;
              text-transform: uppercase; letter-spacing: .1em; margin: 15px 12px 3px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 7px 12px;
              border-radius: 7px; color: #3c5872; font-weight: 400; font-size: 14px; }
.side-nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .6; }
.side-nav a:hover { background: #f1f6f8; color: var(--ink); text-decoration: none; }
.side-nav a.active { background: #e8f1f5; color: var(--ink); font-weight: 600; }
.side-nav a.active svg { opacity: .9; }
.side-nav a .caret { margin-left: auto; color: #a7b3c1; font-size: 15px; }
.side-nav a .pin { width: 12px; height: 12px; margin-left: auto; color: #93a3b5; opacity: 1; }

/* ---------------------------------------------------------------- content */
.main { flex: 1; min-width: 0; padding: 20px 28px 48px; }

.pagehead { display: flex; align-items: flex-start; justify-content: space-between;
            gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 2px; display: flex;
         align-items: center; gap: 6px; }
.crumb svg { width: 15px; height: 15px; }
.crumb b { color: var(--ink); font-weight: 600; }
h1 { font-size: 25px; font-weight: 900; color: var(--ink); letter-spacing: 0; }
h2 { font-size: 15px; font-weight: 800; color: var(--ink); margin: 20px 0 10px; }
.panel > h2:first-child, form.panel > h2:first-child { margin-top: 0; }
.headright { display: flex; align-items: center; gap: 14px; color: var(--muted);
             font-size: 13px; margin-top: 6px; white-space: nowrap; }

/* ------------------------------------------------------------- stat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
         gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stat .stat-h { background: var(--panel-h); padding: 8px 14px; font-weight: 700;
                color: var(--ink); font-size: 13.5px; }
.stat .stat-b { padding: 12px 14px 0; }
.stat .cm { display: flex; justify-content: space-between; align-items: baseline; }
.stat .cm .lbl { color: var(--muted); font-size: 12px; }
.stat .delta { font-size: 12px; font-weight: 700; }
.stat .delta.up { color: var(--ok); } .stat .delta.down { color: var(--bad); }
.stat .num { font-size: 24px; font-weight: 800; color: var(--ink); margin: 2px 0 4px; }
.stat svg.spark { width: 100%; height: 54px; display: block; }
.stat .rows { border-top: 1px solid var(--line-soft); }
.stat .rows div { display: flex; justify-content: space-between; padding: 7px 14px;
                  border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.stat .rows div:last-child { border-bottom: 0; }
.stat .rows b { color: var(--ink); }

/* legacy simple cards (still used on some pages) */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card .num { font-size: 23px; font-weight: 800; color: var(--ink); }
.card .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.card.green .num { color: var(--ok); } .card.red .num { color: var(--bad); } .card.blue .num { color: var(--link); }

/* ----------------------------------------------------------------- panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
         padding: 18px; margin-bottom: 18px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-h { background: var(--panel-h); padding: 10px 16px; font-weight: 700; color: var(--ink);
           font-size: 13.5px; display: flex; justify-content: space-between; align-items: center;
           border-bottom: 1px solid var(--line); }
.panel-h .sub { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.panel-b { padding: 16px; }
.twocol { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 18px; align-items: start; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.kv .item { padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.kv .item:last-child, .kv .item:nth-last-child(2) { border-bottom: 0; }
.kv .k { font-size: 12px; font-weight: 700; color: var(--ink); }
.kv .v { color: var(--text); margin-top: 1px; word-break: break-word; }
.kv .v.mono { font-size: 12px; }

/* ----------------------------------------------------------------- tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel);
        border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.panel.flush table, .panel table { border: 0; border-radius: 0; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
         font-size: 13.5px; vertical-align: middle; }
th { background: #e9edf3; color: var(--ink); font-size: 13px; font-weight: 700; }
th.right { text-align: right; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, tr:hover td { background: #f6f8fb; }
.tfoot { display: flex; justify-content: flex-end; align-items: center; gap: 14px;
         padding: 10px 4px 0; color: var(--muted); font-size: 13px; }

/* dot status like DMS "● Approved" */
.dot { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { color: var(--ok); } .dot.ok::before { background: var(--ok); }
.dot.warn { color: var(--warn); } .dot.warn::before { background: var(--warn); }
.dot.bad { color: var(--bad); } .dot.bad::before { background: var(--bad); }
.vis-title { font-weight: 700; color: var(--ink); font-size: 13px; }

.rule-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.rule-chip .tick { width: 15px; height: 15px; border-radius: 3px; background: var(--ok);
                   color: #fff; display: inline-flex; align-items: center; justify-content: center;
                   font-size: 11px; font-weight: 800; }

.pill, .badge { display: inline-block; padding: 2px 10px; border-radius: 99px;
        font-size: 12px; font-weight: 650; background: var(--line-soft); color: var(--text); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.test { background: #e0edff; color: #1d55c2; }

/* ------------------------------------------------------------------ forms */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; }
label { display: block; font-size: 12.5px; font-weight: 650; color: var(--ink); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 8px 11px; border: 1px solid #c7d0dc;
    border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe4ec; border-color: var(--brand); }
input[disabled] { background: var(--line-soft); color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }

.btn { display: inline-block; background: var(--navy); color: #fff; border: 0; padding: 9px 18px;
       border-radius: 9px; font: inherit; font-weight: 650; cursor: pointer; }
.btn svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.headright .btn { margin-right: 6px; }
td svg { width: 17px; height: 17px; vertical-align: middle; color: var(--link); }
.btn:hover { background: #0f3b4c; text-decoration: none; }
.btn.blue { background: var(--brand); } .btn.blue:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid #c7d0dc; }
.btn.secondary:hover { background: var(--line-soft); }
.btn.small { padding: 4px 12px; font-size: 12.5px; border-radius: 99px; }
.btn.danger { background: #c22f2f; }
.btn.danger:hover { background: #a52626; }

.searchbox { position: relative; min-width: 240px; }
.searchbox input { padding-left: 34px; border-radius: 9px; }
.searchbox svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
                 width: 16px; height: 16px; color: var(--muted); }

.flash { background: var(--ok-bg); border: 1px solid #b5e6c5; color: #177a3d;
         padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; }
.flash.bad { background: var(--bad-bg); border-color: #f0b9b9; color: var(--bad); }

.toolbar { display: flex; gap: 10px; align-items: end; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar > div { min-width: 120px; }
pre.code { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 9px;
           overflow-x: auto; font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.right { text-align: right; }
.copybox { display: flex; gap: 8px; align-items: center; }
.copybox input { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* --------------------------------------------------- reporting menu cards */
.report-menu { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
               max-width: 660px; }
.report-menu a { display: block; padding: 15px 22px; border-bottom: 1px solid var(--line-soft);
                 border-radius: 0; }
.report-menu a:first-child { border-radius: 12px 12px 0 0; }
.report-menu a:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.report-menu a:hover { background: #f0f3f8; text-decoration: none; }
.report-menu .rm-t { font-size: 16px; font-weight: 700; color: var(--ink); }
.report-menu .rm-d { color: var(--text); font-size: 13.5px; margin-top: 1px; }

/* -------------------------------------------------------- login (diagonal) */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center;
             background: linear-gradient(115deg, #f6f9fa 0 55%, var(--rail) 55.2% 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; box-shadow: 0 18px 60px rgba(10,30,45,.25);
             padding: 44px 48px; width: 100%; max-width: 500px; text-align: center; }
.auth-card .brand-mark { justify-content: center; margin-bottom: 18px; }
.auth-card h1 { font-size: 28px; margin-bottom: 22px; }
.auth-card form { text-align: left; }
.auth-card .btn { display: block; margin: 16px auto 0; min-width: 160px; }
.auth-sep { border: 0; border-top: 1px solid var(--line); margin: 24px 0 18px; }
.auth-foot { color: var(--text); font-size: 13.5px; }
.auth-foot .btn { display: inline-block; margin-top: 10px; }

/* ----------------------------------------------------------------- mobile */
@media (max-width: 900px) {
    .grid2, .grid3, .twocol, .kv { grid-template-columns: minmax(0, 1fr); }
    .sidebar { left: 0; width: min(320px, 88vw); border-radius: 0 14px 14px 0; }
    .main { padding: 14px 12px 40px; }
}

/* Wide tables (Offers) scroll sideways INSIDE this box instead of pushing the
   whole page, and the row-actions column is pinned to the right edge so Edit /
   Activate / Pause never scroll out of reach. */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.table-scroll table { border: 0; border-radius: 0; }
.sticky-actions th.col-actions, .sticky-actions td.col-actions {
    position: sticky; right: 0; z-index: 1;
    background: var(--panel);
    box-shadow: -8px 0 8px -8px rgba(0,0,0,.18);
}
.sticky-actions th.col-actions { background: #e9edf3; }
/* Keep the pinned cell opaque on the row-hover tint, or text bleeds through. */
.sticky-actions tr:hover td.col-actions { background: #f6f8fb; }

/* --------------------------- pinned (always-open) menu: desktop widths only */
.side-pin { position: absolute; top: 17px; right: 52px; background: none; border: 0;
            cursor: pointer; color: var(--muted); padding: 4px 6px; z-index: 2; }
.side-pin:hover { color: var(--ink); }
.side-pin svg { width: 15px; height: 15px; }
body.nav-pin .side-pin { color: var(--brand); }
body.nav-pin .sidebar { transform: none; visibility: visible; left: 62px; top: 0; bottom: 0;
                        border-radius: 0; border-top: 0; border-bottom: 0; border-left: 0;
                        box-shadow: none; }
body.nav-pin .main { margin-left: 268px; }
/* The phone rule (max-width 900px) sizes the slide-over drawer to 320px;
   pinned, the drawer is exactly its menu column wide. */
body.nav-pin .sidebar { width: auto; }
@media (max-width: 719px) { .side-pin { display: none; } }
/* Pinned: a submenu column floats over the page while it is in use. */
body.nav-pin .sidebar.sub-open { box-shadow: 10px 0 34px rgba(20,40,60,.16); }

/* Wide tables scroll inside this box (added by page_footer), never the page. */
.tbl-wrap { overflow-x: auto; max-width: 100%; }
