:root {
  --ink: #17211c;
  --muted: #68736d;
  --line: #dde4df;
  --soft: #f3f6f3;
  --paper: #fbfcfa;
  --green: #176b4a;
  --green-2: #0d5137;
  --lime: #c9f27b;
  --blue: #2d64d8;
  --amber: #b46b16;
  --red: #b7423b;
  --shadow: 0 16px 50px rgba(28, 48, 38, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); min-width: 1120px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 7px; color: #758079; font-size: 11px; font-weight: 750; letter-spacing: .13em; }
.brand-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 17px; color: #fff; background: var(--green); font-weight: 800; letter-spacing: -.04em; box-shadow: 0 10px 24px rgba(23, 107, 74, .22); }
.brand-mark.small { width: 39px; height: 39px; border-radius: 12px; font-size: 13px; box-shadow: none; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 40px; background: radial-gradient(circle at 70% 20%, rgba(201,242,123,.55), transparent 27%), linear-gradient(135deg,#eff4ef 0%,#fbfcfa 55%,#eef5f1 100%); }
.login-card { width: 460px; padding: 46px; background: rgba(255,255,255,.92); border: 1px solid rgba(215,225,218,.9); border-radius: 28px; box-shadow: 0 30px 80px rgba(30,55,42,.13); backdrop-filter: blur(12px); }
.login-card .brand-mark { margin-bottom: 30px; }
.login-card h1 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.login-copy { margin: 14px 0 28px; color: var(--muted); line-height: 1.75; }
.login-form { display: grid; gap: 17px; }
label { display: grid; gap: 7px; color: #3d4942; font-size: 13px; font-weight: 650; }
label small { color: #8a958f; font-size: 11px; font-weight: 450; }
input, select, textarea { width: 100%; border: 1px solid #d8e0db; border-radius: 10px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; transition: border .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { border-color: #63a889; box-shadow: 0 0 0 3px rgba(50,133,94,.12); }
select[multiple] { height: 80px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; text-align: center; }
.security-note { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: #8c9690; font-size: 11px; line-height: 1.6; }

.button { border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; transition: transform .15s, background .15s, opacity .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .4; cursor: not-allowed; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-2); }
.button.secondary { color: #34423a; background: #edf1ee; border: 1px solid #d9e1dc; }
.button.wide { width: 100%; padding: 12px; }
.button.compact { padding: 8px 11px; font-size: 12px; }
.button.company { color: #11603f; background: #e2f4e9; }
.button.personal { color: #8b5819; background: #fbefd9; }
.button.temporary { color: #315f8f; background: #e5effa; }
.text-button { border: 0; padding: 4px; color: #78837d; background: none; font-size: 12px; }

.app-shell { display: grid; grid-template-columns: 224px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; z-index: 10; display: flex; flex-direction: column; justify-content: space-between; padding: 25px 18px 20px; border-right: 1px solid #dfe5e1; background: #f4f7f4; }
.brand-row { display: flex; gap: 11px; align-items: center; padding: 0 8px; }
.brand-row strong { display: block; font-size: 15px; }
.brand-row small { display: block; margin-top: 2px; color: #8b958f; font-size: 10px; letter-spacing: .06em; }
.nav { display: grid; gap: 6px; margin-top: 42px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 11px; padding: 12px 13px; color: #647069; background: transparent; font-size: 13px; text-align: left; }
.nav-item span { color: #9ba49f; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.nav-item:hover { background: #eaefeb; }
.nav-item.active { color: #fff; background: #183d2e; box-shadow: 0 8px 20px rgba(24,61,46,.16); }
.nav-item.active span { color: var(--lime); }
.sidebar-foot { display: grid; gap: 12px; padding: 14px 6px 0; border-top: 1px solid var(--line); }
.sidebar-foot > .text-button { justify-self: start; }
.mode-control { display: grid; gap: 9px; }
.mode-badge { display: flex; align-items: center; gap: 7px; color: #6f7973; font-size: 11px; font-weight: 700; }
.mode-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(180,107,22,.1); }
.mode-badge.production i { background: #2b9f69; box-shadow: 0 0 0 4px rgba(43,159,105,.12); }
.mode-badge.read_only i { background: var(--blue); box-shadow: 0 0 0 4px rgba(45,100,216,.12); }
.mode-switch { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 10px; border: 1px solid #d5dfd8; border-radius: 9px; color: #425049; background: #fff; font-size: 10px; font-weight: 750; }
.mode-switch:hover { border-color: #8db5a1; background: #f9fbf9; }
.mode-switch b { color: var(--green); font-size: 13px; }
.mode-switch.production { color: #e9f4ee; border-color: #2f5d48; background: #214936; }
.mode-switch.production b { color: var(--lime); }

.workspace { grid-column: 2; min-width: 0; padding: 0 38px 60px; }
.topbar { position: sticky; top: 0; z-index: 7; display: flex; align-items: center; justify-content: space-between; min-height: 96px; padding: 18px 0; background: rgba(251,252,250,.92); backdrop-filter: blur(13px); border-bottom: 1px solid rgba(221,228,223,.82); }
.topbar h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 13px; }
.endpoint, .clock { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: #707b75; background: #fff; font-size: 11px; }
.clock { border: 0; background: transparent; font-variant-numeric: tabular-nums; }
.page { display: none; padding-top: 28px; }
.page.active { display: block; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .75fr); gap: 18px; }
.hero-card { min-height: 292px; padding: 35px; border-radius: 22px; }
.hero-card.dark { display: flex; flex-direction: column; justify-content: space-between; color: #fff; background: radial-gradient(circle at 90% 20%, rgba(201,242,123,.18), transparent 30%), #173c2d; box-shadow: var(--shadow); }
.hero-card h3 { margin: 17px 0 12px; font-size: 30px; line-height: 1.25; letter-spacing: -.035em; }
.hero-card p { margin: 0; color: #c2d2c9; font-size: 13px; }
.pill { display: inline-flex; width: fit-content; padding: 6px 9px; border-radius: 999px; color: #607068; background: #edf1ee; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.pill.lime { color: #23442d; background: var(--lime); }
.hero-flow { display: flex; align-items: center; gap: 10px; color: #dbe7df; font-size: 11px; }
.hero-flow span { padding: 8px 10px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.05); }
.hero-flow b { color: var(--lime); }
.status-card { padding: 27px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.status-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 750; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; background: #36a36f; box-shadow: 0 0 0 5px rgba(54,163,111,.1); }
.status-card dl { margin: 23px 0 0; }
.status-card dl div { display: flex; justify-content: space-between; padding: 15px 0; border-top: 1px solid #edf0ee; font-size: 12px; }
.status-card dt { color: #7d8781; }
.status-card dd { margin: 0; font-weight: 700; }
.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-top: 18px; }
.metric { padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.metric span, .metric small { display: block; color: #77827b; font-size: 11px; }
.metric strong { display: block; margin: 9px 0 5px; font-size: 29px; letter-spacing: -.04em; }
.metric.accent { background: #eef5df; border-color: #d9e8bb; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin: 37px 0 15px; }
.section-heading h3, .panel-title h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.story-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: 22px; color: inherit; background: #fff; text-align: left; }
.story-card:hover { border-color: #abc7b7; box-shadow: 0 12px 30px rgba(27,72,50,.08); }
.story-no { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--green); background: #e8f2ec; font-size: 11px; font-weight: 800; }
.story-card h4 { margin: 0 0 7px; font-size: 14px; }
.story-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.arrow { color: var(--green); font-size: 20px; }

.page-intro { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.page-intro p { margin: 0; color: var(--muted); font-size: 13px; }
.action-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.mini-metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.mini-metrics.two { grid-template-columns: repeat(2,1fr); }
.mini-metrics.five { grid-template-columns: repeat(5,1fr); }
.mini-metrics.six { grid-template-columns: repeat(6,1fr); }
.mini-metric { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: #69746e; background: #fff; text-align: left; }
.mini-metric strong { color: var(--ink); font-size: 20px; }
.mini-metric.active { border-color: #75aa90; box-shadow: inset 0 0 0 1px #75aa90; }
.panel { border: 1px solid var(--line); border-radius: 17px; background: #fff; box-shadow: 0 10px 35px rgba(31,54,42,.04); }
.table-tools { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--line); }
.search-box { display: flex; align-items: center; gap: 8px; width: 390px; padding: 0 11px; border: 1px solid #dae1dc; border-radius: 9px; background: #fafbf9; }
.search-box span { color: #7e8983; font-size: 20px; }
.search-box input { border: 0; padding: 9px 0; background: transparent; box-shadow: none; }
.selection-tools { display: flex; align-items: center; gap: 8px; }
.selection-tools > span { margin-right: 3px; color: #7b8680; font-size: 11px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 12px 11px; color: #77817b; background: #f7f9f7; font-size: 10px; letter-spacing: .04em; text-align: left; white-space: nowrap; }
td { padding: 13px 11px; border-top: 1px solid #edf0ee; vertical-align: middle; }
tr:hover td { background: #fbfcfb; }
tbody tr { cursor: pointer; }
tbody tr.selected td { background: #eef7f2; }
tbody tr.selected:hover td { background: #e7f3ec; }
th.check, td.check { width: 38px; text-align: center; }
.device-name { font-weight: 750; }
.subtext { display: block; margin-top: 4px; color: #8b958f; font-size: 10px; }
.asset-badge, .sync-badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.asset-badge.company { color: #11603f; background: #e2f4e9; }
.asset-badge.personal { color: #8b5819; background: #fbefd9; }
.asset-badge.temporary { color: #315f8f; background: #e5effa; }
.asset-badge.custom { color: #6446a1; background: #eee8fb; }
.asset-badge.pending { color: #626b66; background: #ecefed; }
.missing-field { color: #a05e17; font-weight: 700; }
.device-status { display: inline-flex; align-items: center; gap: 5px; font-weight: 750; white-space: nowrap; }
.device-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #929b96; }
.device-status.status-1::before { background: #2b9f69; box-shadow: 0 0 0 3px rgba(43,159,105,.1); }
.device-status.status-2::before { background: #d18a2a; }
.device-status.status-0::before { background: #ad4740; }
.sync-badge { color: #55635b; background: #f0f3f1; }
.sync-badge.demo { color: #765213; background: #fff1cf; }
.reason { max-width: 230px; color: #5e6963; line-height: 1.45; }
.empty { padding: 45px; color: #909a94; text-align: center; font-size: 12px; }

.policy-layout { display: grid; grid-template-columns: minmax(620px,1.2fr) minmax(380px,.8fr); gap: 17px; align-items: start; }
.form-panel, .preview-panel { padding: 24px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 23px; }
.ticket-form { display: grid; gap: 15px; }
.user-search-label { position: relative; }
.user-search-box { position: relative; }
.user-search-box input { padding-right: 35px; }
.user-search-box > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #7e8983; font-size: 18px; font-weight: 450; }
.user-search-results { position: absolute; top: 67px; left: 0; right: 0; z-index: 20; padding: 6px; border: 1px solid #d6dfd9; border-radius: 11px; background: #fff; box-shadow: 0 15px 40px rgba(24,54,39,.16); }
.user-result { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 10px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; text-align: left; }
.user-result:hover, .user-result:focus { background: #edf5f0; outline: none; }
.user-result strong { display: block; font-size: 12px; }
.user-result small { display: block; margin-top: 3px; color: #7d8982; font-size: 10px; }
.user-result code { color: var(--green); font-size: 10px; }
.user-no-result { padding: 13px; color: #89938d; font-size: 11px; text-align: center; }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid.three { grid-template-columns: .8fr 1fr 1fr; }
.form-grid.three > label { align-content: start; }
.form-stack { display: grid; grid-template-columns: 1fr; gap: 13px; }
.duration-config { display: grid; grid-template-columns: 1fr; gap: 8px; }
.duration-config:has(input:not(.hidden)) { grid-template-columns: 1fr 1fr; }
.divider { display: flex; align-items: center; gap: 12px; color: #718078; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 3px; }
.preview-panel { position: sticky; top: 116px; max-height: calc(100vh - 145px); overflow: auto; background: #17271f; border-color: #17271f; color: #fff; }
.preview-panel .eyebrow { color: #8fa298; }
.preview-placeholder { display: grid; place-items: center; min-height: 350px; color: #87988f; text-align: center; }
.preview-placeholder span { font-size: 46px; color: #6e8177; }
.preview-placeholder p { margin-top: -100px; font-size: 11px; }
.api-step { margin-bottom: 18px; }
.api-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.method { padding: 4px 6px; border-radius: 5px; color: #173c2d; background: var(--lime); font-size: 9px; font-weight: 850; }
.api-step code { color: #dce7e1; font-size: 11px; }
pre { margin: 0; overflow: auto; padding: 13px; border-radius: 9px; color: #c9d6cf; background: #0e1b15; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.expires-note { padding: 11px; border: 1px solid #355242; border-radius: 9px; color: #bad0c4; font-size: 11px; }
.ticket-list { display: grid; gap: 10px; }
.ticket-card { display: grid; grid-template-columns: 150px 1fr 1fr 180px auto; align-items: center; gap: 18px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.ticket-card strong { display: block; font-size: 12px; }
.ticket-card small { display: block; margin-top: 4px; color: #87918b; font-size: 10px; }
.ticket-status { width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; }
.ticket-status.active { color: #11603f; background: #e2f4e9; }
.ticket-status.expired { color: #666; background: #ecefed; }
.ticket-status.revoked { color: #933d37; background: #f9e6e4; }

.log-list { display: grid; gap: 9px; }
.log-entry { border: 1px solid var(--line); border-radius: 13px; background: #fff; overflow: hidden; }
.log-summary { display: grid; grid-template-columns: 70px 220px 1fr 110px 140px 22px; align-items: center; gap: 12px; padding: 15px 17px; cursor: pointer; }
.log-summary:hover { background: #fafbf9; }
.log-operation { font-weight: 750; font-size: 12px; }
.log-path { overflow: hidden; color: #66716b; font: 10px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.log-meta { color: #8a948e; font-size: 10px; }
.log-result { font-size: 10px; font-weight: 750; }
.log-result.ok { color: #18704d; }
.log-result.fail { color: var(--red); }
.log-detail { display: none; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 17px 17px; }
.log-entry.open .log-detail { display: grid; }
.log-detail h5 { margin: 0 0 7px; color: #77827b; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.log-detail pre { color: #dbe6e0; }

.toast { position: fixed; top: 20px; left: 50%; z-index: 100; transform: translate(-50%,-20px); padding: 11px 17px; border-radius: 10px; color: #fff; background: #1b3c2e; box-shadow: 0 12px 30px rgba(20,50,37,.24); font-size: 12px; opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
.toast.error { background: #8d3531; }
.dialog { width: 420px; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(18,40,29,.25); }
.dialog::backdrop { background: rgba(15,29,22,.45); backdrop-filter: blur(3px); }
.dialog form { padding: 28px; text-align: center; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 14px; border-radius: 50%; color: #8c5b17; background: #fff0cf; font-weight: 850; }
.dialog h3 { margin: 0; }
.dialog p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.dialog-actions { display: flex; justify-content: center; gap: 9px; margin-top: 20px; }

.cmdb-dialog { width: min(900px, calc(100vw - 64px)); padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: #fbfcfa; box-shadow: 0 32px 90px rgba(18,40,29,.28); }
.cmdb-dialog::backdrop { background: rgba(15,29,22,.5); backdrop-filter: blur(4px); }
.cmdb-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 27px 30px 22px; border-bottom: 1px solid var(--line); }
.cmdb-dialog-head h3 { margin: 0; font-size: 23px; }
.cmdb-dialog-head > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.dialog-close { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; color: #77827c; background: #edf1ee; font-size: 22px; line-height: 1; }
.dialog-close:hover { color: var(--ink); background: #e2e8e4; }
.cmdb-dialog-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; padding: 24px 30px 30px; }
.cmdb-step-card { position: relative; min-height: 340px; padding: 26px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.cmdb-step-card.download { display: flex; flex-direction: column; }
.cmdb-step-card.download .button { margin-top: auto; }
.cmdb-step-no { position: absolute; top: 17px; right: 18px; color: #a1aaa5; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.cmdb-step-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 18px; border-radius: 13px; color: var(--green); background: #e6f3eb; font-size: 24px; font-weight: 750; }
.cmdb-step-card h4 { margin: 0 0 10px; font-size: 17px; }
.cmdb-step-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.cmdb-drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 275px; padding: 24px; border: 2px dashed #cdd9d1; border-radius: 14px; background: #f7faf8; text-align: center; outline: none; transition: border-color .18s, background .18s, transform .18s; }
.cmdb-drop-zone .cmdb-step-icon { margin-bottom: 13px; }
.cmdb-drop-zone p { margin-bottom: 17px; }
.cmdb-drop-zone small { margin-top: 13px; color: #929c96; font-size: 10px; }
.cmdb-drop-zone:hover, .cmdb-drop-zone:focus, .cmdb-drop-zone.dragging { border-color: #54a27f; background: #edf7f1; transform: translateY(-1px); }
.cmdb-drop-zone.uploading { pointer-events: none; opacity: .65; }
.cmdb-group-option { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 11px 12px; border: 1px solid #d8e2dc; border-radius: 10px; background: #f7faf8; cursor: pointer; }
.cmdb-group-option input { margin-top: 2px; accent-color: var(--green); }
.cmdb-group-option span { display: flex; flex-direction: column; gap: 3px; }
.cmdb-group-option strong { font-size: 11px; }
.cmdb-group-option small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.cmdb-import-status { margin-top: 12px; padding: 10px 12px; border-radius: 9px; color: #7d8982; background: #f2f5f3; font-size: 11px; }
.cmdb-import-status.success { color: #176b4a; background: #e5f4eb; }
.cmdb-import-status.error { color: #963b35; background: #fae9e7; }

@media (max-width: 1240px) {
  .workspace { padding-left: 25px; padding-right: 25px; }
  .policy-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; max-height: none; }
  .ticket-card { grid-template-columns: 130px 1fr 1fr 160px auto; }
}
