/* tunnel-portal: dark sidebar (#001529), light content area. The theme colour comes from /brand.css. */
:root { --side: #001529; --side-hover: #0b2a47; --bg: #f5f7fa; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb; --ok: #16a34a; --bad: #dc2626; --warn: #d97706; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--brand, #1668dc); }

/* layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; flex: none; background: var(--side); color: #cbd5e1; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; }
.logo { width: 36px; height: 36px; border-radius: 8px; flex: none; }
.brand-name { font-size: 16px; font-weight: 600; color: #fff; line-height: 1.3; }
.brand-tag { font-size: 12px; color: #94a3b8; }
.menu { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; color: #cbd5e1; text-decoration: none; }
.menu-item:hover { background: var(--side-hover); color: #fff; }
.menu-item.active { background: var(--brand, #1668dc); color: #fff; }
.side-foot { padding: 12px 16px 16px; border-top: 1px solid #12304d; }
.who { font-size: 13px; color: #e2e8f0; margin-bottom: 6px; overflow-wrap: anywhere; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: #94a3b8; cursor: pointer; font: inherit; }
.link-btn:hover { color: #fff; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 18px; }
.device { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.content { padding: 24px; }

/* forced password change */
.forced-page { min-height: 100vh; display: flex; flex-direction: column; }
.forced-bar { display: flex; align-items: center; justify-content: space-between; background: var(--side); padding: 0 16px; }
.forced-bar .link-btn { color: #cbd5e1; }

/* login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--brand, #1668dc); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 10px; padding: 28px 28px 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.login-head { text-align: center; margin-bottom: 18px; }
.login-head .logo { width: 56px; height: 56px; border-radius: 12px; }
.login-head h1 { margin: 10px 0 2px; font-size: 20px; }
.login-head p { margin: 0; color: var(--muted); }
.login-device { margin-top: 14px; text-align: center; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* forms */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; margin-bottom: 4px; font-weight: 500; }
.field.check { display: flex; align-items: center; gap: 8px; }
.hint { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=number], select { width: 100%; padding: 8px 10px; font: inherit; color: inherit; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; }
input:focus, select:focus { outline: 2px solid var(--brand, #1668dc); outline-offset: -1px; border-color: transparent; }
input[readonly] { background: #f1f5f9; }
input.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: .5px; }
.btn { display: inline-block; padding: 7px 16px; font: inherit; color: var(--text); background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: var(--brand, #1668dc); color: var(--brand, #1668dc); }
.btn.primary { color: #fff; background: var(--brand, #1668dc); border-color: var(--brand, #1668dc); }
.btn.primary:hover { filter: brightness(1.1); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 2px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.error { margin: 0 0 12px; padding: 8px 12px; color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; }
.notice { margin: 0 0 14px; padding: 8px 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* application cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 18px; color: inherit; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .12); transform: translateY(-2px); }
.card.offline, .card.disabled { opacity: .6; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--brand, #1668dc); border-radius: 10px; }
.card-icon .icon { width: 24px; height: 24px; }
.card-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.card-name { margin-top: 6px; font-size: 16px; font-weight: 600; }
.card-desc { min-height: 22px; color: var(--muted); font-size: 13px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.enter { margin-left: auto; color: var(--brand, #1668dc); font-weight: 500; }
.tag { padding: 0 8px; font-size: 12px; color: var(--muted); background: #f1f5f9; border-radius: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: #9ca3af; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); }
.dot.offline { background: var(--bad); }
.card-status .dot { margin-right: 0; }

/* tables and panels */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.panel.narrow { max-width: 460px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar select { width: auto; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 500; background: #fafbfc; }
.table td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 140px; }
.table td.ops { display: flex; gap: 6px; }
.pill { display: inline-block; margin-right: 4px; padding: 0 8px; font-size: 12px; border-radius: 10px; }
.pill.on { color: #166534; background: #dcfce7; }
.pill.off { color: #991b1b; background: #fee2e2; }
.pill.warn { color: #92400e; background: #fef3c7; }

/* dialogs */
.mask { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow-y: auto; background: rgba(15, 23, 42, .5); }
.dialog { width: 100%; max-width: 520px; padding: 22px; background: #fff; border-radius: 10px; box-shadow: 0 20px 40px rgba(0, 0, 0, .3); }
.dialog h3 { margin: 0 0 14px; font-size: 17px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.grants { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.grant-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.grant-row select { width: 150px; }
.grant-name { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .menu { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: flex; align-items: center; justify-content: space-between; }
  .content { padding: 14px; }
}
