/* SkyOMS app UI */
:root {
  --app-bg: #f5f6fa;
  --app-panel: #ffffff;
  --app-line: #e3e6ef;
  --app-text: #161b2e;
  --app-muted: #646c85;
  --app-primary: #3346d3;
  --app-primary-ink: #ffffff;
  --app-ok: #0f8a5f;
  --app-ok-bg: #e6f6ef;
  --app-err: #b42318;
  --app-err-bg: #fdecea;
  --app-warn: #9a6400;
  --app-warn-bg: #fff4dc;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--app-bg); color: var(--app-text); font: 400 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--app-primary); }
h1 { font-size: 22px; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 24px 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
p { margin: 0 0 12px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
pre.code { background: #0f1426; color: #e6e9f5; padding: 10px 12px; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--app-muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.brand-mark { font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--app-text); text-decoration: none; }
.brand-mark span { color: var(--app-primary); }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--app-panel); border-bottom: 1px solid var(--app-line); }
.tenant-name { color: var(--app-muted); padding-left: 14px; border-left: 1px solid var(--app-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.bell { position: relative; text-decoration: none; font-size: 18px; }
.bell b { position: absolute; top: -6px; right: -10px; background: var(--app-err); color: #fff; font-size: 11px; border-radius: 99px; padding: 0 6px; }
.user-menu { position: relative; }
.user-menu summary { cursor: pointer; list-style: none; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu[open] summary, .user-menu summary:hover { background: var(--app-bg); }
.user-menu > div { position: absolute; right: 0; top: 40px; background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 10px; padding: 8px; min-width: 200px; display: grid; gap: 2px; box-shadow: 0 8px 24px rgba(20,30,60,.12); }
.user-menu > div > span { padding: 6px 10px; font-size: 12px; }
.user-menu a, .user-menu button { display: block; text-align: left; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--app-text); text-decoration: none; border-radius: 6px; cursor: pointer; font: inherit; }
.user-menu a:hover, .user-menu button:hover { background: var(--app-bg); }
.nav-toggle { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; }
.sidebar { position: fixed; top: 56px; bottom: 0; left: 0; width: 220px; padding: 16px 12px; background: var(--app-panel); border-right: 1px solid var(--app-line); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar a { padding: 9px 12px; border-radius: 8px; color: var(--app-text); text-decoration: none; font-weight: 500; }
.sidebar a:hover { background: var(--app-bg); }
.sidebar a.active { background: #e9ecff; color: var(--app-primary); font-weight: 650; }
.content { margin-left: 220px; padding: 24px 28px 48px; max-width: 1280px; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .tenant-name { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; }
  .content { margin-left: 0; padding: 16px; }
}

/* Building blocks */
.card { background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 480px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--app-line); background: var(--app-panel); color: var(--app-text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c7cce0; }
.btn.primary { background: var(--app-primary); color: var(--app-primary-ink); border-color: var(--app-primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--app-err); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--app-ok-bg); color: var(--app-ok); border-color: #b9e6d2; }
.flash.error { background: var(--app-err-bg); color: var(--app-err); border-color: #f5c2bd; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; font-weight: 600; font-size: 13px; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { width: 100%; padding: 9px 11px; border: 1px solid #cfd4e3; border-radius: 8px; font: inherit; background: #fff; color: var(--app-text); }
.form input:focus, .form select:focus { outline: 2px solid #c3cbff; border-color: var(--app-primary); }
.form .hint { font-weight: 400; color: var(--app-muted); font-size: 12px; }
.form .err { font-weight: 500; color: var(--app-err); font-size: 12.5px; }
.form fieldset { border: 1px solid var(--app-line); border-radius: 10px; padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
.form legend { font-weight: 700; padding: 0 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }

.table-wrap { overflow-x: auto; background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 12px; margin-bottom: 16px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--app-line); text-align: left; vertical-align: middle; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--app-muted); background: #fafbfd; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef0f6; color: var(--app-muted); }
.badge.ok { background: var(--app-ok-bg); color: var(--app-ok); }
.badge.err { background: var(--app-err-bg); color: var(--app-err); }
.badge.warn { background: var(--app-warn-bg); color: var(--app-warn); }
.badge.blue { background: #e9ecff; color: var(--app-primary); }

.progress { height: 8px; background: #edf0f7; border-radius: 99px; overflow: hidden; min-width: 120px; }
.progress i { display: block; height: 100%; background: var(--app-primary); border-radius: 99px; }
.progress.done i { background: var(--app-ok); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--app-text); }
.tile b { display: block; font-size: 15px; margin-bottom: 4px; }
.tile:hover { border-color: #c7cce0; }

.pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

.heatmap { border-collapse: separate; border-spacing: 3px; font-size: 11px; }
.heatmap td { width: 26px; height: 22px; border-radius: 4px; text-align: center; color: #fff; }
.heatmap th { font-weight: 500; color: var(--app-muted); padding: 0 4px; }

/* Auth / installer */
body.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(800px 400px at 20% 0%, #e3e8ff, transparent 60%), var(--app-bg); }
.auth-card { width: min(400px, 100%); background: var(--app-panel); border: 1px solid var(--app-line); border-radius: 16px; padding: 28px; box-shadow: 0 20px 50px rgba(30,40,90,.08); }
.auth-card.wide { width: min(760px, 100%); }
.auth-card h1 { margin-top: 14px; }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 4px; }
.checklist .pass { color: var(--app-ok); }
.checklist .fail { color: var(--app-err); font-weight: 600; }
[hidden] { display: none !important; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.nav-toggle .icon, .bell .icon { width: 22px; height: 22px; }
.bell { color: var(--app-text); display: inline-flex; }
.checklist .icon { width: 1em; height: 1em; }

/* Logos: platform (top-left) and brand (top-right) */
.brand-mark { display: inline-flex; align-items: center; }
.platform-logo { height: 32px; max-width: 180px; object-fit: contain; display: block; }
.platform-logo.login { height: 44px; max-width: 240px; }
.brand-logo { height: 34px; max-width: 160px; object-fit: contain; display: block; }
.logo-preview { display: flex; align-items: center; justify-content: center; height: 120px; border: 1px dashed #cfd4e3; border-radius: 10px; background: repeating-conic-gradient(#f3f4f8 0 25%, #fff 0 50%) 0 0 / 16px 16px; margin-bottom: 14px; }
.logo-preview img { max-height: 90px; max-width: 80%; object-fit: contain; }
.logo-preview.dark { background: #0b1020; }
@media (max-width: 860px) { .brand-logo { height: 28px; max-width: 110px; } .platform-logo { height: 26px; max-width: 130px; } }
@media (max-width: 860px) { .user-menu summary { max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .topbar { gap: 10px; padding: 0 12px; } }
