:root {
  --ink: #17211f;
  --muted: #65726f;
  --paper: #f4f6f3;
  --surface: #ffffff;
  --line: #dce3df;
  --green: #16624f;
  --green-2: #0f8063;
  --lime: #d8ef71;
  --coral: #e7704f;
  --amber: #e9b949;
  --blue: #3f72af;
  --shadow: 0 18px 55px rgba(28, 58, 48, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-width: 320px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar {
  background: #143b32;
  color: #f5f9f7;
  padding: 26px 18px 22px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 24px; }
.brand-mark { width: 37px; height: 37px; border-radius: 12px; background: var(--lime); color: #143b32; display: grid; place-items: center; font-weight: 900; }
.brand-name { font-size: 14px; line-height: 1.2; font-weight: 740; letter-spacing: -.01em; }
.brand-name small { display: block; color: #a7c2b9; font-size: 11px; font-weight: 500; margin-top: 4px; }
.nav { display: grid; gap: 3px; overflow-y: auto; padding-right: 2px; }
.nav a { text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px; color: #c8d9d3; font-size: 13px; font-weight: 600; }
.nav a::before { content: attr(data-icon); width: 23px; color: #8db2a5; font-weight: 800; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.nav a.active::before { color: var(--lime); }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.11); padding: 16px 8px 0; }
.user-name { font-size: 13px; font-weight: 700; }
.user-role { font-size: 11px; color: #a7c2b9; margin-top: 3px; }
.logout { margin-top: 10px; background: transparent; border: 0; padding: 0; color: #c8d9d3; font-size: 12px; }

.main { min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 18px 32px; border-bottom: 1px solid var(--line); background: rgba(244,246,243,.91); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 15; }
.eyebrow { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.topbar h1 { margin: 4px 0 0; font-size: 22px; letter-spacing: -.035em; }
.sync-chip { display: flex; align-items: center; gap: 8px; background: #e8f1ed; color: var(--green); padding: 8px 12px; border-radius: 99px; font-size: 12px; font-weight: 720; }
.sync-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #37a67b; box-shadow: 0 0 0 4px rgba(55,166,123,.13); }
.content { padding: 28px 32px 54px; max-width: 1660px; margin: 0 auto; }

.filters { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 12px; display: flex; gap: 9px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; box-shadow: 0 6px 28px rgba(24,54,45,.04); }
.filters label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; font-weight: 750; }
.filters select, .filters input { min-width: 135px; }
input, select, textarea { border: 1px solid #cfd8d3; background: #fff; border-radius: 9px; padding: 9px 10px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(15,128,99,.11); }
.button, button.primary { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 9px; padding: 10px 14px; background: var(--green); color: #fff; font-weight: 720; text-decoration: none; font-size: 13px; }
.button.secondary, button.secondary { background: #e9efec; color: var(--green); }
.button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }

.hero-panel { border-radius: 24px; padding: 26px 28px; background: #143b32; color: #fff; display: grid; grid-template-columns: minmax(0,1.25fr) minmax(290px,.75fr); gap: 28px; margin-bottom: 18px; overflow: hidden; position: relative; }
.hero-panel::after { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; right: -110px; top: -150px; border: 65px solid rgba(216,239,113,.12); }
.hero-panel h2 { font-size: clamp(25px, 2.6vw, 39px); margin: 8px 0 8px; letter-spacing: -.045em; line-height: 1.05; max-width: 760px; }
.hero-panel p { color: #b9d0c7; margin: 0; line-height: 1.55; max-width: 730px; font-size: 14px; }
.hero-figure { align-self: end; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; z-index: 1; }
.hero-stat { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.11); border-radius: 14px; padding: 15px; }
.hero-stat strong { display: block; font-size: 29px; letter-spacing: -.04em; }
.hero-stat span { font-size: 11px; color: #b9d0c7; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 18px; }
.metric-grid.basic-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-height: 125px; box-shadow: 0 7px 24px rgba(31,70,58,.04); position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 72px; height: 72px; border-radius: 50%; background: var(--metric-color, #dfeee8); right: -34px; bottom: -35px; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.35; }
.metric-value { font-size: 28px; font-weight: 790; letter-spacing: -.045em; margin: 12px 0 5px; }
.metric-foot { color: var(--muted); font-size: 11px; }
.metric.good { --metric-color: #b8e8d8; }
.metric.warn { --metric-color: #f4d290; }
.metric.bad { --metric-color: #f3a58f; }
.metric.blue { --metric-color: #b8d1ed; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.55fr); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; box-shadow: 0 7px 24px rgba(31,70,58,.04); min-width: 0; }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 17px; }
.panel-title { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-subtitle { color: var(--muted); font-size: 11px; margin-top: 4px; }
.chart { min-height: 260px; position: relative; }
.chart canvas { width: 100%; height: 260px; display: block; }

.funnel-list { display: grid; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: 132px 1fr 45px; gap: 10px; align-items: center; font-size: 12px; }
.funnel-bar { height: 9px; background: #edf1ef; border-radius: 99px; overflow: hidden; }
.funnel-bar i { height: 100%; display: block; background: var(--green-2); border-radius: inherit; min-width: 2px; }
.quality-split { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.quality-item { padding: 12px; background: #f5f7f5; border-radius: 11px; }
.quality-item strong { display: block; font-size: 22px; }
.quality-item span { font-size: 10px; color: var(--muted); }

.page-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-actions p { margin: 0; color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 24px rgba(31,70,58,.04); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; padding: 13px 14px; border-bottom: 1px solid var(--line); background: #fafbfa; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #edf0ee; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfb; }
.row-title { font-weight: 720; max-width: 370px; }
.row-title a { text-decoration: none; }
.row-title a:hover { color: var(--green-2); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.tag { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 8px; font-size: 10px; font-weight: 750; background: #e9efec; color: #365e52; white-space: nowrap; }
.tag.open, .tag.success { background: #dff3ea; color: #167053; }
.tag.closed, .tag.neutral { background: #edf0ef; color: #65726f; }
.tag.warning, .tag.running { background: #fff1cc; color: #916719; }
.tag.critical, .tag.failed { background: #fde5dd; color: #a14027; }
.progress { min-width: 110px; }
progress { width: 100%; height: 7px; border: 0; border-radius: 99px; overflow: hidden; background: #e7ece9; appearance: none; }
progress::-webkit-progress-bar { background: #e7ece9; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--green-2); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--green-2); border-radius: 99px; }
.progress progress { margin-top: 6px; display: block; }
.funnel-bar progress { display: block; height: 9px; }

.empty { padding: 50px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 6px; }
.modal-card, .form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 680; }
.form-grid .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid textarea { min-height: 78px; resize: vertical; }
.form-actions { display: flex; align-items: end; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.vacancy-hero { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: start; margin-bottom: 16px; }
.vacancy-hero h2 { margin: 0 0 8px; font-size: 27px; letter-spacing: -.04em; }
.vacancy-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 12px; }
.stat-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 16px 0; }
.strip-item { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.strip-item strong { display: block; font-size: 20px; }
.strip-item span { color: var(--muted); font-size: 10px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(400px, .72fr); background: #143b32; }
.login-story { padding: clamp(40px, 8vw, 110px); color: #fff; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-story::after { content: ""; position: absolute; width: 510px; height: 510px; border: 115px solid rgba(216,239,113,.13); border-radius: 50%; right: -250px; bottom: -190px; }
.login-story h1 { font-size: clamp(42px, 5.2vw, 76px); line-height: .96; letter-spacing: -.065em; margin: 70px 0 18px; max-width: 750px; }
.login-story p { color: #bdd2ca; max-width: 590px; line-height: 1.55; }
.login-badges { display: flex; gap: 10px; flex-wrap: wrap; z-index: 1; }
.login-badges span { border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.07); border-radius: 99px; padding: 8px 11px; font-size: 11px; }
.login-panel { background: var(--paper); padding: 45px clamp(28px, 6vw, 85px); display: flex; align-items: center; }
.login-form { width: 100%; max-width: 440px; margin: 0 auto; }
.login-form h2 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.045em; }
.login-form > p { color: var(--muted); margin: 0 0 28px; font-size: 13px; }
.login-form label { display: grid; gap: 7px; margin-bottom: 14px; font-size: 12px; font-weight: 700; }
.login-form input { padding: 13px; }
.login-form button { width: 100%; margin-top: 10px; padding: 13px; }
.error-box { background: #fde5dd; color: #963b25; padding: 11px 12px; border-radius: 9px; margin-bottom: 15px; font-size: 12px; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  .sidebar { padding: 20px 10px; }
  .brand-name, .nav a span, .sidebar-footer { display: none; }
  .brand { padding: 0 8px 20px; }
  .nav a { justify-content: center; padding: 11px 8px; }
  .nav a::before { width: auto; }
  .topbar { padding: 15px 20px; }
  .content { padding: 22px 20px 45px; }
  .hero-panel { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid.basic-metrics { grid-template-columns: repeat(2, 1fr); }
  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 40vh; padding: 36px; }
  .login-story h1 { margin-top: 40px; }
}

@media (max-width: 580px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; bottom: 0; top: auto; height: 62px; width: 100%; padding: 7px 10px; }
  .brand, .sidebar-footer { display: none; }
  .nav { grid-template-columns: repeat(5, 1fr); overflow: hidden; }
  .nav a { font-size: 0; padding: 10px 4px; }
  .nav a:nth-child(n+6) { display: none; }
  .nav a::before { font-size: 11px; }
  .topbar { position: static; }
  .sync-chip { display: none; }
  .content { padding: 18px 14px 86px; }
  .hero-panel { padding: 21px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid.basic-metrics { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .vacancy-hero { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; padding: 28px; }
}
