/* ==========================================================================
   TRWX / OZON Tools — UI Contract (for shared understanding)

   Purpose:
   - Keep "card-like" visuals defined ONLY here.
   - Page-level CSS must NOT redefine card basics (bg/border/radius/shadow).
   - When you send me any page CSS/HTML, I will assume this contract.

   Card System (single source of truth):
   1) .card
      - Meaning: generic elevated container (default shadow).
      - Use for: main sections, page cards, modal shell (if ok with default shadow).
      - MUST NOT redefine in page CSS:
        background, border, border-radius, box-shadow

   2) .card-lite
      - Meaning: light container (no shadow, only border+radius).
      - Use for: small blocks, filters, inline info groups, table wrappers, side widgets.
      - MUST NOT redefine in page CSS:
        background, border, border-radius

   3) .panel
      - Meaning: structural card (header/body layout semantics).
      - Visual equals .card, plus overflow hidden.
      - Use for: containers with .panel-header / .panel-body.

   Compatibility Aliases:
   - .card-shadow
     - Legacy alias for .card visuals.
     - Allowed in old pages; new pages prefer .card.

   Page CSS Allowed:
   - layout (grid/flex), spacing (padding/margin), typography, hover effects,
     and decorative layers (e.g., ::before glow) on top of .card.
   - Shadow enhancement on hover is allowed, BUT base shadow stays in .card.

   Quick Rule:
   - If it looks like a card, it MUST be .card / .card-lite / .panel (or legacy .card-shadow).
   ========================================================================== */

/* assets/common.css — design system (variables + shared components) */

:root{
  /* theme */
  --primary:#2563eb;
  --primary2:#1d4ed8;

  --bg:#f6f8ff;
  --bg2:#eef2ff;

  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;

  --border:rgba(15,23,42,.10);
  --border2:rgba(15,23,42,.18);

  --radius:18px;
  --radius-sm:14px;

  --shadow: 0 18px 45px rgba(15,23,42,.12);
  --shadow2: 0 8px 18px rgba(15,23,42,.08);

  /* aliases / compatibility */
  --panel: var(--card);
  --panel2: #f6f8fb;
  --chip:#eef2ff;
  --danger:#dc2626;
  --warn:#d97706;
  --ok:#16a34a;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC","Hiragino Sans GB","Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(37,99,235,.20), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(29,78,216,.16), transparent 50%),
    linear-gradient(180deg, var(--bg), var(--bg2));
}

a{ color:inherit; text-decoration:none; }
.hidden{ display:none !important; }
.muted{ color: var(--muted); }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* ===== layout helpers ===== */
.container{
  max-width: 1000px;
  margin: 0 auto;
  padding: 22px 20px 34px;
}
.layout{
  display:grid;
  gap: 14px;
  padding: 14px;
  max-width: 1840px;
  margin: 0 auto;
}

/* ===== topbar ===== */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}


/* ===== topbar layout ===== */
.topbar .inner{
  max-width: 1840px;
  margin: 0 auto;
  padding: 12px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}
.brand .logo{
  width:34px;
  height:34px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  box-shadow: 0 8px 18px rgba(37,99,235,.28);
  flex: 0 0 auto;
}
.brand .title{
  font-weight: 900;
  letter-spacing: .2px;
  color: var(--text);
  line-height: 1.1;
}
.brand .sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.2;
}
.topbar-actions{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== badges ===== */
.badge{
  font-size:12px;
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  color: var(--muted);
  background: rgba(255,255,255,.78);
}
.pill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,.18);
  background: rgba(37,99,235,.08);
  color: rgba(37,99,235,.95);
  font-weight: 800;
}

/* ===== buttons / inputs ===== */
.btn{
  appearance:none;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.88);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor:pointer;
  user-select:none;
}
.btn:hover{ border-color: rgba(15,23,42,.28); }
.btn:active{ transform: translateY(1px); }

.btn-primary{
  border-color: rgba(79,140,255,.45);
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  color: #fff;
  font-weight: 900;
}
.btn-ghost{ background: transparent; }

.btn-sm{
  padding: 8px 10px;
  border-radius: 12px;
}

.btn-primary-soft{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(37,99,235,.22);
  background: linear-gradient(180deg, rgba(37,99,235,.14), rgba(37,99,235,.08));
  color: rgba(37,99,235,.95);
  font-weight: 900;
  user-select:none;
}
.btn-primary-soft:hover{
  background: linear-gradient(180deg, rgba(37,99,235,.18), rgba(37,99,235,.10));
}


/* ===== element fallbacks (legacy pages without classes) =====
   Some older pages use plain <button> / <select> / <input> without .btn/.input.
   These rules give them the same baseline look so pages stay visually consistent.
   If a control already has a specific class (e.g. .btn, .tab, .more-btn), it won't be affected.
*/

:where(button):not(.btn):not(.tab):not(.more-btn):not(.modal-close):not(.track-link),
:where(input[type="button"], input[type="submit"], input[type="reset"]):not(.btn){
  appearance:none;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.88);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor:pointer;
  user-select:none;
}
:where(button):not(.btn):not(.tab):not(.more-btn):not(.modal-close):not(.track-link):hover,
:where(input[type="button"], input[type="submit"], input[type="reset"]):not(.btn):hover{
  border-color: rgba(15,23,42,.28);
}
:where(button):not(.btn):not(.tab):not(.more-btn):not(.modal-close):not(.track-link):active,
:where(input[type="button"], input[type="submit"], input[type="reset"]):not(.btn):active{
  transform: translateY(1px);
}
:where(button):not(.btn):not(.tab):not(.more-btn):not(.modal-close):not(.track-link):focus-visible,
:where(input[type="button"], input[type="submit"], input[type="reset"]):not(.btn):focus-visible{
  outline: 2px solid rgba(79,140,255,.35);
  outline-offset: 2px;
}

/* Text inputs/selects/textarea fallback to .input look */
:where(input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="password"], input[type="number"], input[type="tel"]):not(.input):not(.input-date),
:where(select):not(.input):not(.input-date),
:where(textarea):not(.input){
  width:100%;
  min-height: 40px;
  background: rgba(255,255,255,.92);
  color: var(--text);
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  outline:none;
}
:where(textarea):not(.input){
  padding: 10px 12px;
}
:where(input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="password"], input[type="number"], input[type="tel"]):not(.input):not(.input-date):focus,
:where(select):not(.input):not(.input-date):focus,
:where(textarea):not(.input):focus{
  border-color: rgba(79,140,255,.55);
}

.input{
  width:100%;
  height: 40px;
  background: rgba(255,255,255,.92);
  color: var(--text);
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  outline:none;
}
.input:focus{ border-color: rgba(79,140,255,.55); }
.label{ display:block; font-size:12px; color:var(--muted); margin-bottom:6px; }
.hint{ margin-top:10px; color:var(--muted); font-size:12px; }

/* ===== card system (single source of truth) ===== */
.card,
.panel,
.card-shadow{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-lite{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: none;
}

.panel{ overflow:hidden; }

.panel-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.92);
}
.panel-title{ font-weight: 900; }
.panel-meta{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.panel-body{ padding: 14px; }

/* ===== tables ===== */
.table-wrap{
  margin-top:12px;
  overflow:auto;
  border-radius: 14px;
  border:1px solid var(--border);
  background: var(--panel);
}
.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}
.table thead th{
  position:sticky; top:0; z-index:5;
  background: var(--panel2);
  text-align:left;
  font-size:12px;
  font-weight:800;
  color: #475569;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  white-space:nowrap;
}
.table tbody td{
  padding: 12px 12px;
  border-bottom: 1px solid rgba(15,23,42,.06);
  vertical-align:top;
  font-size: 14px;
  line-height: 1.35;
}
.table tbody tr:hover{ background: rgba(2,6,23,.03); }

/* ===== toast ===== */
.toast{
  position:fixed; right:18px; bottom:18px;
  background: rgba(255,255,255,.95);
  border:1px solid var(--border);
  padding:10px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow2);
}

@media (max-width: 1100px){
  .layout{ grid-template-columns: 1fr !important; }
}


/* ===== cards & panels (compat) ===== */
.card, .panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow2);
}
.card{ padding: 16px 18px; }
.card-tight{ padding: 12px 14px; border-radius: 14px; }
.card-header{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:10px; }
.card-title{ font-size: 18px; font-weight: 900; letter-spacing: .2px; }
.card-sub{ color: var(--muted); font-size: 13px; margin-top: 2px; }

.cards{
  display:grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px;
}
@media (min-width: 820px){
  .cards{ grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}

/* ===== footer ===== */
.footer{
  margin-top: 44px;
  background: #0b1220;
  color: rgba(255,255,255,.86);
}
.footer .container{ padding: 18px 20px; }
.footer a{ color: rgba(199,210,254,.95); }
.footer small{ color: rgba(226,232,240,.75); }

/* ===== small utilities ===== */
.muted{ color: var(--muted); }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.filters{ display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
