/* Style follows the Merusoft mobile app (3_UX_Design/3_14_Mobile_Smartoffice,
   merusoft_scenario_full.html): Ant Design palette, 12-18px cards, pill buttons,
   grey fields, bottom tab bar with a blue center FAB. */
:root {
  --blue-1:#E6F7FF; --blue-3:#91D5FF; --blue-6:#1890FF; --blue-7:#096DD9;
  --orange-1:#FFF7E6; --orange-3:#FFD591; --orange-6:#FA8C16;
  --green-1:#F6FFED; --green-3:#B7EB8F; --green-6:#52C41A; --green-7:#389E0D;
  --red-1:#FFF1F0; --red-3:#FFA39E; --red-6:#F5222D;
  --yellow-1:#FFFBE6; --yellow-6:#FAAD14;
  --gray-1:#FAFAFA; --gray-3:#F5F5F5; --gray-4:#EDEDED; --gray-5:#D9D9D9; --gray-7:#8C8C8C; --gray-9:#262626;
  --page:#f0f2f5; --shadow:0 2px 8px rgba(0,0,0,0.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--gray-9);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--blue-6); text-decoration: none; }
a:hover { color: var(--blue-7); }
h1 { font-size: 22px; font-weight: 600; margin: 4px 0 14px; }
h2 { font-size: 16px; font-weight: 600; margin: 22px 0 12px; }
.section-title { font-size: 16px; font-weight: 600; padding-left: 12px; border-left: 4px solid var(--blue-6); margin: 24px 0 12px; }
.muted { color: var(--gray-7); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace; font-size: 13px; }
svg.i { width: 20px; height: 20px; flex-shrink: 0; }

/* header (desktop) */
.top { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--gray-4); padding-top: env(safe-area-inset-top); }
.top-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 10px 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--gray-9); white-space: nowrap; }
.brand:hover { color: var(--gray-9); }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #1890FF 0%, #096DD9 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.brand small { display: block; font-size: 11px; color: var(--gray-7); font-weight: 400; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border-radius: 20px; color: var(--gray-9); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; color: var(--gray-7); }
.nav a:hover { background: var(--gray-3); }
.nav a.on { background: var(--blue-1); color: var(--blue-6); }
.nav a.on svg { color: var(--blue-6); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 20px 40px; }

/* bottom tab bar (phone) */
.tab-bar { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
  .top-in { padding: 8px 16px; min-height: 56px; }
  .wrap { padding: 16px 12px 110px; }
  .tab-bar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--gray-3);
  }
  .tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; color: var(--gray-7); font-size: 10px; }
  .tab-item svg { width: 22px; height: 22px; }
  .tab-item.on { color: var(--blue-6); }
  .tab-fab-slot { flex: 1; position: relative; }
  .fab {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%); width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #1890FF 0%, #096DD9 100%); color: #fff;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(24,144,255,0.45);
  }
  .fab svg { width: 28px; height: 28px; }
  h1 { font-size: 20px; }
  .hide-m { display: none !important; }
}

/* cards */
.card { background: #fff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.card + .card, .grid2 + .card, .card + .grid2 { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid2 > .card { margin-top: 0; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } .card { padding: 16px; border-radius: 14px; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.msg { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; }
.msg.ok { background: var(--green-1); color: var(--green-7); border: 1px solid var(--green-3); }
.msg.bad { background: var(--red-1); color: var(--red-6); border: 1px solid var(--red-3); }

/* pill buttons, as in the app */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 10px 20px; border-radius: 24px; border: 1.5px solid var(--gray-5); background: #fff;
  color: var(--gray-9); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--blue-6); color: var(--blue-6); }
.btn.primary { background: var(--blue-6); border-color: var(--blue-6); color: #fff; }
.btn.primary:hover { background: var(--blue-7); border-color: var(--blue-7); color: #fff; }
.btn.danger { color: var(--red-6); }
.btn.danger:hover { border-color: var(--red-6); }
.btn.small { min-height: 34px; padding: 5px 14px; font-size: 13px; font-weight: 500; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.add-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1.5px dashed var(--gray-5);
  border-radius: 12px; font-size: 13px; color: var(--blue-6); background: #fff; }

/* fields: grey background, like .field-input in the app */
label { display: block; font-size: 12px; color: var(--gray-7); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 11px 14px; border: 1px solid transparent; border-radius: 10px;
  background: var(--gray-3); color: var(--gray-9); font: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-6); background: #fff; box-shadow: 0 0 0 3px var(--blue-1); }
input[readonly] { color: var(--gray-7); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue-6); vertical-align: -4px; margin-right: 6px; }
label.check { font-size: 14px; color: var(--gray-9); font-weight: 400; margin-bottom: 10px; }
.field { margin-bottom: 16px; }
.fields3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .fields3 { grid-template-columns: 1fr; gap: 0; } }

/* segmented switch, like the period tabs in the app */
.seg { display: inline-flex; background: var(--gray-3); border-radius: 22px; padding: 3px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { margin: 0; padding: 9px 16px; cursor: pointer; color: var(--gray-9); font-size: 14px; font-weight: 500; border-radius: 20px; }
.seg input:checked + label { background: var(--blue-6); color: #fff; box-shadow: 0 2px 6px rgba(24,144,255,0.35); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip { padding: 6px 12px; border: 1px solid var(--gray-5); border-radius: 16px; font-size: 12px; color: var(--gray-9); background: #fff; cursor: pointer; font-family: inherit; }
.chip:hover { border-color: var(--blue-6); color: var(--blue-6); }
.units { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
@media (max-width: 960px) { .units { grid-template-columns: repeat(2, 1fr); } }
.units .field { margin: 0; }
.units label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.actions form { display: contents; }
@media (max-width: 760px) { .actions .btn { flex: 1 1 100%; } }

/* status tags */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid; }
.badge.ok { background: var(--green-1); color: var(--green-7); border-color: var(--green-3); }
.badge.warn { background: var(--orange-1); color: var(--orange-6); border-color: var(--orange-3); }
.badge.bad { background: var(--red-1); color: var(--red-6); border-color: var(--red-3); }
.badge.plain { background: var(--gray-3); color: var(--gray-9); border-color: var(--gray-4); }
.badge.blue { background: var(--blue-1); color: var(--blue-6); border-color: var(--blue-3); }

/* search and filters */
.filters { display: flex; gap: 10px; margin-bottom: 12px; }
.filters input[type=search] { flex: 1; background: #fff; box-shadow: var(--shadow); border-radius: 22px; padding-left: 18px; }
.counts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.counts a { padding: 6px 14px; border-radius: 16px; border: 1px solid var(--gray-5); background: #fff; color: var(--gray-9); font-size: 13px; }
.counts a.on { background: var(--blue-6); border-color: var(--blue-6); color: #fff; }
.count { background: var(--blue-6); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 10px; font-weight: 500; }

/* client + licenses */
.company { padding: 0; overflow: hidden; margin-bottom: 14px; }
.company + .company { margin-top: 0; }
.company-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--gray-3); }
.company-h .ava { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-1); color: var(--blue-6);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.company-h a.name { font-weight: 600; font-size: 15px; color: var(--gray-9); }
table.lic { width: 100%; border-collapse: collapse; }
table.lic th { text-align: left; font-weight: 500; font-size: 12px; color: var(--gray-7); padding: 10px 18px; background: var(--gray-1); }
table.lic td { padding: 12px 18px; border-top: 1px solid var(--gray-3); vertical-align: middle; }
table.lic tr.click { cursor: pointer; }
table.lic tr.click:hover td { background: var(--gray-1); }
table.lic td.lead { border-left: 4px solid var(--gray-5); font-weight: 600; }
table.lic tr.s-active td.lead { border-left-color: var(--green-6); }
table.lic tr.s-expiring td.lead, table.lic tr.s-unsigned td.lead { border-left-color: var(--orange-6); }
table.lic tr.s-expired td.lead, table.lic tr.s-bad td.lead { border-left-color: var(--red-6); }
/* on phones rows become cards with a colored left stripe, like .mb-card */
@media (max-width: 760px) {
  table.lic thead { display: none; }
  table.lic, table.lic tbody, table.lic tr, table.lic td { display: block; width: 100%; }
  table.lic tbody { padding: 10px 12px 2px; }
  table.lic tr { position: relative; padding: 12px 14px 12px 16px; margin-bottom: 10px; border-radius: 12px; background: var(--gray-1); border-left: 4px solid var(--gray-5); }
  table.lic tr.s-active { border-left-color: var(--green-6); }
  table.lic tr.s-expiring, table.lic tr.s-unsigned { border-left-color: var(--orange-6); }
  table.lic tr.s-expired, table.lic tr.s-bad { border-left-color: var(--red-6); }
  table.lic td, table.lic td.lead { padding: 1px 0; border: 0; background: none !important; }
  table.lic td.lead { font-size: 14px; padding-right: 110px; }
  table.lic td.st { position: absolute; top: 12px; right: 12px; width: auto; }
  table.lic td[data-l] { font-size: 12px; color: var(--gray-7); }
  table.lic td[data-l]::before { content: attr(data-l) ": "; }
  .company-h { padding: 12px 14px; }
}

dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 14px; margin: 0; }
dl.kv dt { color: var(--gray-7); font-size: 13px; }
dl.kv dd { margin: 0; word-break: break-word; font-weight: 500; }
@media (max-width: 760px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dt { font-size: 12px; } dl.kv dd { margin-bottom: 10px; } }
pre.json { background: var(--gray-3); border-radius: 10px; padding: 14px; overflow: auto; font-size: 12.5px; max-height: 360px; margin: 0; }
details summary { cursor: pointer; color: var(--blue-6); font-weight: 500; margin: 2px 0; }
details p { color: var(--gray-9); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 10px 0; border-bottom: 1px solid var(--gray-3); }
ul.plain li:last-child { border-bottom: 0; }

.login { max-width: 400px; margin: 9vh auto 0; }
.login h1 { text-align: center; }
.login .logo-big { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: linear-gradient(135deg, #1890FF 0%, #096DD9 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; box-shadow: 0 4px 16px rgba(24,144,255,0.45); }
.diff-old { color: var(--gray-7); text-decoration: line-through; margin-right: 6px; font-weight: 400; }
.diff-new { color: var(--blue-6); font-weight: 600; }
.drop { border: 1.5px dashed var(--gray-5); border-radius: 14px; padding: 24px; text-align: center; background: var(--gray-1); }
.drop.over { border-color: var(--blue-6); background: var(--blue-1); }
/* honeypot: off-screen, never visible to people */
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.code-input { font-size: 18px; letter-spacing: 1.5px; text-align: center; }
.draft-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; margin-top: 10px; border-left: 4px solid var(--orange-6); background: var(--gray-1); }
