:root {
  color-scheme: light;
  --iti-path-flags-1x: url("./flags.webp");
  --iti-path-flags-2x: url("./flags@2x.webp");
  --bg: #eee8d9;
  --ink: #203036;
  --muted: #687570;
  --panel: rgba(255, 253, 247, 0.94);
  --line: rgba(88, 75, 48, 0.2);
  --dark: #102635;
  --dark-2: #17384b;
  --gold: #b78628;
  --gold-soft: #f4e7bf;
  --teal: #17796f;
  --teal-soft: #dcefe9;
  --blue: #286f9f;
  --blue-soft: #dce9f3;
  --violet: #65558b;
  --violet-soft: #e8e2f2;
  --green: #2f8b65;
  --green-soft: #deefe4;
  --amber: #a87016;
  --amber-soft: #f6e6bf;
  --red: #bd5047;
  --red-soft: #f5deda;
  --surface: rgba(255, 253, 247, 0.9);
  --surface-strong: #fffdf7;
  --surface-soft: rgba(247, 242, 228, 0.92);
  --control-bg: rgba(255, 253, 247, 0.88);
  --topbar-bg: rgba(250, 247, 238, 0.95);
  --sidebar-bg: rgba(22, 39, 42, 0.97);
  --sidebar-ink: #f8f4e8;
  --shadow: 0 18px 50px rgba(67, 55, 31, 0.14);
  --shadow-small: 0 7px 20px rgba(67, 55, 31, 0.1);
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #071421;
  --ink: #e5eef9;
  --muted: #8ea2b8;
  --panel: rgba(13, 36, 54, 0.94);
  --line: #1c3d53;
  --dark: #050e18;
  --dark-2: #0a1b2a;
  --gold: #d6b25e;
  --gold-soft: #3b321d;
  --teal: #18d398;
  --teal-soft: #0e3a32;
  --blue: #2b8cff;
  --blue-soft: #0b2b4c;
  --violet: #a899cf;
  --violet-soft: #201c33;
  --green: #18d398;
  --green-soft: #0e3a32;
  --amber: #d6b25e;
  --amber-soft: #3b321d;
  --red: #ff5f67;
  --red-soft: #3b1d25;
  --surface: rgba(13, 36, 54, 0.9);
  --surface-strong: #0d2436;
  --surface-soft: rgba(7, 20, 33, 0.62);
  --control-bg: rgba(7, 20, 33, 0.88);
  --topbar-bg: rgba(4, 14, 24, 0.97);
  --sidebar-bg: rgba(5, 15, 25, 0.98);
  --sidebar-ink: #ffffff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  --shadow-small: 0 8px 24px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(238, 232, 217, 0.84), rgba(238, 232, 217, 0.92)),
    url("./assets/portal-villa-day.webp") center / cover fixed no-repeat,
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

html[data-theme="night"] body {
  background:
    linear-gradient(rgba(4, 14, 24, 0.9), rgba(7, 20, 33, 0.95)),
    url("./assets/portal-villa-day.webp") center / cover fixed no-repeat,
    var(--bg);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.layout {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  min-height: 60px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 18px;
  align-items: center;
  color: var(--ink);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  background: transparent;
}

.app-column {
  min-width: 0;
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 100vh;
  padding: 14px;
  color: var(--sidebar-ink);
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

body:not(.is-authenticated) .app-shell {
  grid-template-columns: 1fr;
}

body:not(.is-authenticated) .sidebar {
  display: none;
}

body:not(.is-authenticated) .topbar-search,
body:not(.is-authenticated) .topbar-icon-button,
body:not(.is-authenticated) .top-workday-timer,
body:not(.is-authenticated) .user-menu-shell {
  display: none;
}

body.is-authenticated .auth-topbar-brand {
  display: none;
}

.sidebar-brand h1 {
  overflow: visible;
  font-size: 17px;
  line-height: 1.08;
  white-space: normal;
}

.sidebar-brand h1 span {
  display: block;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  width: 100%;
  min-height: 58px;
  padding: 0 8px 14px;
  color: var(--sidebar-ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo,
.auth-rw-mark {
  --logo-cloud-fill: var(--dark);
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 64px;
  height: 42px;
  color: var(--gold);
  font-weight: 950;
  line-height: 1;
}

.sidebar-brand .brand-logo {
  --logo-cloud-fill: #16272a;
}

.brand-rw {
  display: inline-block;
  font-size: 34px;
  letter-spacing: -5px;
  transform: scaleX(1.12);
  transform-origin: left center;
}

.brand-cloud {
  position: absolute;
  right: 1px;
  top: 9px;
  z-index: 2;
  width: 24px;
  height: 13px;
  background: var(--logo-cloud-fill);
  border: 2px solid currentColor;
  border-radius: 999px;
}

.brand-cloud::before,
.brand-cloud::after {
  position: absolute;
  content: "";
  background: var(--logo-cloud-fill);
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 999px 999px 0 0;
}

.brand-cloud::before {
  left: 3px;
  top: -9px;
  width: 11px;
  height: 9px;
}

.brand-cloud::after {
  right: 2px;
  top: -7px;
  width: 9px;
  height: 7px;
}

.sidebar-brand p,
.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-brand p,
.sidebar .contract,
.source-card p {
  color: rgba(229, 238, 249, 0.58);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

.sidebar h2 {
  margin: 24px 0 12px;
  font-size: 15px;
}

.source-list {
  display: grid;
  gap: 10px;
}

.source-card {
  padding: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.source-card strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.source-card p {
  margin: 8px 0 0;
  font-size: 13px;
}

.source-list.light .source-card {
  background: var(--surface-soft);
  border-color: var(--line);
}

.source-list.light .source-card p {
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(63, 142, 85, 0.16);
}

.dot.off {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(197, 138, 46, 0.16);
}

.contract {
  padding-left: 18px;
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
  margin: 16px 0 0;
  padding: 0;
  border-radius: 8px;
  background: transparent;
}

.sidebar-nav button {
  min-height: 44px;
  padding: 0 11px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.nav-glyph {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #9fb4cb;
  border: 1px solid rgba(159, 180, 203, 0.26);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
}

.sidebar-nav button:hover,
.sidebar-nav button.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.94), rgba(11, 132, 255, 0.92));
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.22);
}

.sidebar-nav button.active .nav-glyph,
.sidebar-nav button:hover .nav-glyph {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.34);
}

.sidebar-nav button:active {
  transform: scale(0.97);
}

.nav-section {
  margin: 16px 8px 5px;
  color: rgba(142, 162, 184, 0.72);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section:first-child {
  margin-top: 0;
}

.workspace {
  min-width: 0;
  width: calc(100% - 28px);
  margin: 0 auto;
  padding: 14px 0 60px;
}

.hero,
.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.hero {
  margin-bottom: 14px;
  align-items: center;
}

.hero h2 {
  max-width: 850px;
  font-size: 24px;
  line-height: 1.12;
}

body[data-view="home"] .hero {
  display: none;
}

.auth-topbar-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 16px;
}

.auth-topbar-brand .brand-logo {
  width: 58px;
  --logo-cloud-fill: var(--topbar-bg);
}

.topbar-actions {
  position: relative;
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.topbar-search {
  justify-self: start;
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 10px 0 14px;
  color: var(--muted);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar-search input {
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.topbar-search input::placeholder {
  color: rgba(142, 162, 184, 0.78);
}

.language-picker,
.user-menu-shell {
  position: relative;
}

.topbar-icon-button,
.top-workday-timer {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.topbar-icon-button {
  width: 38px;
}

.top-workday-timer {
  min-width: 112px;
  padding: 0 12px;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.language-toggle {
  display: inline-grid;
  width: 42px;
  height: 36px;
  place-items: center;
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.theme-toggle {
  display: inline-grid;
  width: 42px;
  height: 36px;
  place-items: center;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 19px;
  line-height: 1;
}

.user-menu-toggle {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 4px 10px 4px 5px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.user-menu-toggle:hover,
.language-toggle:hover,
.theme-toggle:hover,
.topbar-icon-button:hover {
  border-color: var(--teal);
  background: var(--surface-strong);
}

.top-user-avatar,
.menu-avatar {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--dark);
  background: var(--gold-soft);
  border: 1px solid rgba(214, 178, 94, 0.52);
  border-radius: 8px;
  font-weight: 900;
}

.top-user-avatar {
  width: 32px;
  height: 32px;
}

.top-user-avatar img,
.menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-user-avatar::after,
.menu-avatar::after {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 9px;
  height: 9px;
  content: "";
  background: var(--amber);
  border: 2px solid var(--dark);
  border-radius: 50%;
}

.top-user-avatar.online::after,
.top-user-avatar.newbie::after,
.menu-avatar.online::after,
.menu-avatar.newbie::after {
  background: #3cc986;
}

.top-user-avatar.vacation::after,
.top-user-avatar.lunch::after,
.top-user-avatar.businessTrip::after,
.menu-avatar.vacation::after,
.menu-avatar.lunch::after,
.menu-avatar.businessTrip::after {
  background: var(--blue);
}

.top-user-avatar.dismissed::after,
.top-user-avatar.sick::after,
.menu-avatar.dismissed::after,
.menu-avatar.sick::after {
  background: var(--red);
}

.language-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: grid;
  min-width: 148px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(4, 15, 25, 0.18);
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: min(330px, calc(100vw - 24px));
  padding: 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 50px rgba(4, 15, 25, 0.22);
}

.user-menu-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.menu-avatar {
  width: 48px;
  height: 48px;
}

.user-menu-head strong,
.user-menu-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-head span,
.user-menu-facts dd {
  color: var(--muted);
  font-size: 12px;
}

.user-menu-facts {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.user-menu-facts div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
}

.user-menu-facts dt,
.user-menu-facts dd {
  margin: 0;
}

.user-menu-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.user-menu-facts dd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-actions {
  display: grid;
  gap: 6px;
}

.user-menu-actions button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.user-menu-actions button:hover {
  color: var(--teal);
  background: var(--teal-soft);
}

.language-menu button {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 0 8px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.language-menu button:hover {
  color: var(--teal);
  background: var(--teal-soft);
}

.flag-icon {
  display: inline-block;
  width: 23px;
  height: 15px;
  flex: 0 0 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(14, 30, 26, 0.22);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.flag-ru {
  background: linear-gradient(to bottom, #fff 0 33.33%, #1c57a6 33.33% 66.66%, #d52b1e 66.66% 100%);
}

.flag-th {
  background: linear-gradient(
    to bottom,
    #da291c 0 16.66%,
    #fff 16.66% 33.33%,
    #2d2a4a 33.33% 66.66%,
    #fff 66.66% 83.33%,
    #da291c 83.33% 100%
  );
}

.flag-en {
  background:
    radial-gradient(circle at 18% 18%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 38% 18%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 58% 18%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 28% 38%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 48% 38%, #fff 0 1px, transparent 1.5px),
    linear-gradient(#3c3b6e 0 0) 0 0 / 46% 54% no-repeat,
    repeating-linear-gradient(to bottom, #b22234 0 7.69%, #fff 7.69% 15.38%);
}

.sync-panel {
  border-color: rgba(22, 119, 95, 0.16);
}

.sync-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.46fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.sync-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sync-actions button {
  min-height: 42px;
  padding: 0 12px;
  color: var(--teal);
  background: var(--panel);
  border: 1px solid rgba(22, 119, 95, 0.22);
  border-radius: 8px;
  font-weight: 900;
}

.sync-actions button:hover {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(24, 117, 111, 0.12);
}

.sync-actions button:disabled {
  cursor: progress;
  opacity: 0.58;
}

.sync-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.sync-item {
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid #c7bfad;
  border-radius: 8px;
}

.sync-item strong {
  font-size: 12px;
}

.sync-item span,
.sync-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-item.ok {
  border-left-color: var(--green);
}

.sync-item.error {
  border-left-color: var(--red);
}

.sync-item.running {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 460px);
  gap: 0;
  justify-content: center;
  align-items: start;
  margin-bottom: 18px;
}

.auth-login-panel {
  position: relative;
  background: var(--panel);
  border-top: 3px solid var(--gold);
  box-shadow: var(--shadow);
}

.auth-login-panel::after {
  position: absolute;
  right: 14px;
  bottom: 12px;
  content: "RWO CLOUD";
  color: color-mix(in srgb, var(--muted) 28%, transparent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.employee-dashboard {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 12px;
  min-height: calc(100vh - 88px);
}

.dashboard-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 12px;
}

.dashboard-people-panel {
  margin: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100vh - 88px);
  max-height: calc(100vh - 88px);
}

.panel-count {
  min-width: 30px;
  min-height: 24px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid rgba(43, 140, 255, 0.28);
  border-radius: 999px;
  font-size: 12px;
}

.dashboard-people-actions {
  padding-top: 12px;
}

.dashboard-people-actions button {
  width: 100%;
}

.home-work-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 12px;
}

.home-work-grid > * {
  min-width: 0;
}

.home-profile-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.profile-avatar {
  width: 78px;
  height: 78px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--dark);
  background: var(--gold-soft);
  border: 2px solid rgba(214, 178, 94, 0.52);
  border-radius: 8px;
  font-size: 24px;
  font-weight: 900;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-profile-card strong,
.home-profile-card span,
.home-profile-card small {
  display: block;
}

.home-profile-card strong {
  font-size: 22px;
}

.home-profile-card span,
.home-profile-card small {
  color: var(--muted);
}

.profile-facts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.home-team-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 3px;
}

.home-team-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-person {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 66px;
  padding: 8px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.team-person.active,
.team-person:hover {
  border-color: color-mix(in srgb, var(--teal) 52%, transparent);
  background: var(--teal-soft);
}

.team-avatar {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: var(--blue-soft);
  border-radius: 8px;
  font-weight: 900;
}

.team-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-person strong,
.team-person small,
.team-person em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-person small,
.team-person b {
  color: var(--muted);
  font-size: 12px;
}

.team-person em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.team-person em.online,
.team-person em.newbie {
  color: var(--green);
}

.team-person em.lunch,
.team-person em.away,
.team-person em.business_trip,
.team-person em.vacation {
  color: var(--amber);
}

.team-person b {
  font-weight: 900;
}

.workday-timer {
  min-width: 108px;
  padding: 7px 10px;
  color: var(--teal);
  text-align: center;
  background: var(--teal-soft);
  border: 1px solid rgba(22, 119, 95, 0.22);
  border-radius: 8px;
  font-weight: 900;
}

.home-kpi-grid {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.home-kpi-grid button {
  min-width: 0;
  min-height: 104px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 4px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
}

.home-kpi-grid button:nth-child(2) {
  border-top-color: var(--teal);
}

.home-kpi-grid button:nth-child(3) {
  border-top-color: var(--violet);
}

.home-kpi-grid button:nth-child(4) {
  border-top-color: var(--red);
}

.home-kpi-grid button:nth-child(5) {
  border-top-color: var(--amber);
}

.home-kpi-grid button:hover {
  border-color: rgba(43, 140, 255, 0.68);
  transform: translateY(-1px);
}

.home-kpi-grid strong {
  font-size: 28px;
  line-height: 1;
  color: var(--ink);
}

.home-kpi-grid span,
.home-kpi-grid small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.home-kpi-grid small {
  color: var(--green);
}

.compact-task-list,
.reminder-list {
  display: grid;
  gap: 8px;
}

.compact-task {
  min-height: 52px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-task small {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.compact-task small b {
  color: var(--blue);
  font-size: 11px;
}

.dashboard-task-panel {
  margin: 0;
}

.text-action {
  min-height: 32px;
  padding: 0 10px;
  color: var(--blue);
  background: transparent;
  border: 1px solid rgba(43, 140, 255, 0.3);
  border-radius: 7px;
  font-weight: 800;
}

.dashboard-table-scroll {
  max-height: 300px;
}

.dashboard-task-table th,
.dashboard-task-table td {
  padding: 10px 9px;
}

.dashboard-task-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.dashboard-task-title a {
  color: var(--ink);
  text-decoration: none;
}

.dashboard-task-title a:hover {
  color: var(--blue);
}

.dashboard-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid rgba(43, 140, 255, 0.28);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-status.hold {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(214, 178, 94, 0.32);
}

.dashboard-status.progress {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(24, 211, 152, 0.28);
}

.dashboard-assignee {
  display: block;
  max-width: 250px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-task strong,
.compact-task span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-task a {
  color: var(--ink);
  text-decoration: none;
}

.compact-task a:hover {
  color: var(--blue);
  text-decoration: underline;
}

.compact-task span,
.compact-task small {
  color: var(--muted);
  font-size: 12px;
}

.urgent-text {
  color: var(--red) !important;
  font-weight: 900;
}

.compact-empty {
  min-height: 96px;
  display: grid;
  place-items: center;
}

.reminder-item {
  min-height: 54px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reminder-item span {
  color: var(--muted);
  font-weight: 900;
}

.settings-list,
.permission-model {
  display: grid;
  gap: 8px;
}

.settings-list div,
.permission-model div {
  min-height: 54px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-list span,
.permission-model span {
  color: var(--muted);
  font-size: 12px;
}

.home-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.home-action-grid button {
  min-height: 76px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

body[data-view="auth"] .workspace {
  width: min(520px, calc(100% - 32px));
  padding-top: clamp(28px, 7vh, 74px);
}

body[data-view="auth"] .hero {
  display: none;
}

.auth-brand-mark {
  margin: 2px 0 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--dark);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

html[data-theme="night"] .auth-brand-mark {
  color: var(--ink);
}

#auth-state-badge {
  display: none;
}

.auth-rw-mark {
  --logo-cloud-fill: var(--panel);
  width: 78px;
  height: 50px;
  flex: 0 0 auto;
}

.auth-rw-mark .brand-rw {
  font-size: 42px;
}

.auth-rw-mark .brand-cloud {
  top: 9px;
  width: 29px;
  height: 15px;
}

.auth-login-form {
  display: grid;
  gap: 14px;
}

.auth-login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-login-form input,
.auth-login-form select {
  min-height: 48px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.auth-login-form input:focus,
.auth-login-form select:focus {
  border-color: rgba(22, 119, 95, 0.55);
  box-shadow: 0 0 0 4px rgba(22, 119, 95, 0.12);
  background: var(--surface-strong);
}

.auth-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-actions button:not(.primary-action),
.oauth-row button {
  min-height: 42px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.auth-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.oauth-row {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.oauth-row span {
  color: var(--muted);
  font-size: 12px;
}

.trusted-device-panel {
  margin-top: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px 12px;
  align-items: center;
  background: var(--teal-soft);
  border: 1px dashed rgba(22, 119, 95, 0.34);
  border-radius: 8px;
}

.trusted-device-panel strong,
.trusted-device-panel small {
  display: block;
}

.trusted-device-panel small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.trusted-qr {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  color: var(--dark);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.access-request-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.access-request-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.access-request-form input,
.access-request-form textarea {
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.access-request-form .wide-field,
.access-request-form .form-actions {
  grid-column: span 4;
}

.current-user-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.current-user-card span,
.current-user-card small {
  color: var(--muted);
  font-size: 12px;
}

.session-policy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.session-policy-grid div {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.session-policy-grid span,
.access-state small {
  color: var(--muted);
  font-size: 12px;
}

.role-chips,
.access-state {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.access-state {
  flex-direction: column;
}

.role-chips span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid #bfe1dc;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.presence-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  margin-left: 4px;
  padding: 0 8px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid rgba(22, 119, 95, 0.2);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.presence-badge.offline,
.presence-badge.absent {
  color: #66747f;
  background: color-mix(in srgb, var(--surface-soft) 76%, #7f8b94 24%);
  border-color: color-mix(in srgb, var(--line) 72%, #7f8b94 28%);
}

html[data-theme="night"] .presence-badge.offline,
html[data-theme="night"] .presence-badge.absent,
html[data-theme="night"] .team-person em.offline,
html[data-theme="night"] .team-person em.absent {
  color: #91a0ae;
}

.presence-badge.dismissed,
.presence-badge.sick {
  color: #9c3f31;
  background: var(--red-soft);
  border-color: rgba(189, 91, 75, 0.24);
}

.ok-text {
  color: #28713d !important;
}

.data-grid {
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 0.45fr);
}

.data-contract {
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(260px, 1.5fr) repeat(3, minmax(140px, 1fr));
  gap: 12px;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filters select,
.filters input[type="search"] {
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.filters select:focus,
.filters input[type="search"]:focus {
  border-color: rgba(22, 119, 95, 0.55);
  box-shadow: 0 0 0 4px rgba(22, 119, 95, 0.1);
}

.filters input[type="search"]::placeholder {
  color: #9a9285;
}

.active-tag-filter button {
  min-height: 24px;
  padding: 0 8px;
  color: #5d4320;
  background: var(--amber-soft);
  border: 1px solid #e7cf9a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.checkbox {
  display: flex !important;
  gap: 9px !important;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink) !important;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics,
.grid {
  display: grid;
  gap: 12px;
}

.metrics {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  margin-bottom: 14px;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
}

.metric {
  padding: 14px;
}

.metric span,
.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin: 8px 0;
  font-size: 32px;
  line-height: 1;
}

.grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  margin-bottom: 14px;
}

.app-view {
  display: grid;
  gap: 14px;
}

.statistics-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.statistics-kpis article {
  min-width: 0;
  padding: 16px;
  background: var(--panel);
  border-top: 3px solid var(--teal);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
}

.statistics-kpis span,
.statistics-kpis small {
  display: block;
  color: var(--muted);
}

.statistics-kpis strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 30px;
  line-height: 1;
}

.statistics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 14px;
}

.statistics-bars {
  display: grid;
  gap: 16px;
}

.statistics-bar {
  display: grid;
  grid-template-columns: 130px minmax(100px, 1fr) 42px;
  gap: 12px;
  align-items: center;
}

.statistics-bar > div {
  height: 10px;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.statistics-bar i {
  display: block;
  min-width: 4px;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
}

.statistics-bar.progress i { background: var(--teal); }
.statistics-bar.hold i { background: var(--amber); }
.statistics-bar.done i { background: var(--green); }

.kanban-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  align-items: end;
  padding: 4px 2px;
}

.kanban-toolbar > span {
  color: var(--muted);
}

.kanban-board {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  min-width: 260px;
  background: color-mix(in srgb, var(--panel) 90%, var(--surface-soft));
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
}

.kanban-column.progress { border-top-color: var(--teal); }
.kanban-column.hold { border-top-color: var(--amber); }
.kanban-column.done { border-top-color: var(--green); }

.kanban-column > header {
  min-height: 48px;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.kanban-column > header strong {
  min-width: 26px;
  min-height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
}

.kanban-column-body {
  max-height: calc(100vh - 230px);
  min-height: 180px;
  padding: 9px;
  display: grid;
  gap: 8px;
  align-content: start;
  overflow-y: auto;
}

.kanban-card {
  padding: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.kanban-card.overdue {
  border-left: 3px solid var(--red);
}

.kanban-card > strong,
.kanban-card > span,
.kanban-card footer {
  display: block;
  margin-top: 8px;
}

.kanban-card > strong {
  line-height: 1.35;
}

.kanban-card > span,
.kanban-card small,
.kanban-card time {
  color: var(--muted);
  font-size: 12px;
}

.kanban-card-top,
.kanban-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.kanban-empty {
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.new-task-panel {
  width: min(980px, 100%);
  margin: 0 auto;
}

.new-task-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.new-task-form label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.new-task-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.new-task-form .wide-field {
  grid-column: 1 / -1;
}

#new-task-message {
  color: var(--teal);
  font-weight: 800;
}

.service-launcher-panel,
.workflow-list-panel,
.service-editor,
.service-placeholder {
  width: min(1180px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.service-discovery {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.service-search-field {
  display: flex;
  min-width: min(380px, 100%);
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-search-field:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 14%, transparent);
}

.service-search-field .ui-icon {
  color: var(--muted);
}

.service-search-field input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
}

.service-categories {
  max-width: 100%;
  overflow-x: auto;
}

.new-service-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.new-service-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 118px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.new-service-card:hover,
.new-service-card.active {
  background: var(--teal-soft);
  border-color: color-mix(in srgb, var(--teal) 50%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 10%, transparent);
}

.new-service-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--teal);
  background: var(--surface-strong);
  border: 1px solid color-mix(in srgb, var(--teal) 24%, var(--line));
  border-radius: 7px;
}

.new-service-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
  align-content: start;
}

.new-service-copy strong {
  font-size: 14px;
  line-height: 1.25;
}

.new-service-copy small,
.new-service-copy > span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.new-service-copy small {
  color: var(--teal);
  font-weight: 800;
}

.new-service-empty {
  grid-column: 1 / -1;
}

.vacation-request-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.vacation-request-form > label,
.route-override-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.vacation-request-form input,
.vacation-request-form select,
.vacation-request-form textarea {
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.vacation-request-form textarea {
  resize: vertical;
}

.vacation-request-form .wide-field {
  grid-column: 1 / -1;
}

.route-overrides {
  padding: 10px 12px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.route-overrides summary {
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.vacation-route-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.vacation-route-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
  align-items: center;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.vacation-route-step > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}

.vacation-route-step div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.vacation-route-step small,
.vacation-route-step strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vacation-route-step small {
  color: var(--muted);
  font-size: 10px;
}

.vacation-route-step strong {
  font-size: 12px;
}

.vacation-route-step.resolved {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}

.vacation-route-step.unresolved {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
}

.vacation-route-step em {
  grid-column: 1 / -1;
  color: var(--teal);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.route-override-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.workflow-form-actions {
  align-items: center;
}

#vacation-request-message {
  margin-right: auto;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.service-placeholder > p:last-child {
  color: var(--muted);
}

.workflow-request-list {
  display: grid;
  gap: 8px;
}

.workflow-request {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-request-main {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 58px;
  padding: 9px 12px 5px;
}

.workflow-toggle {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  color: var(--teal);
  background: transparent;
  border: 0;
  font-size: 18px;
}

.workflow-toggle.compact {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 3px;
  vertical-align: middle;
  font-size: 15px;
}

.workflow-request-title {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.workflow-request-title strong,
.workflow-request-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-request-title span {
  color: var(--muted);
  font-size: 12px;
}

.workflow-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.workflow-status.in_progress,
.workflow-status.submitted {
  color: var(--teal);
  background: var(--teal-soft);
}

.workflow-status.completed {
  color: var(--green);
  background: var(--green-soft);
}

.workflow-status.needs_revision {
  color: var(--amber);
  background: var(--amber-soft);
}

.workflow-status.rejected,
.workflow-status.withdrawn {
  color: var(--red);
  background: var(--red-soft);
}

.workflow-stage-rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--stage-count), minmax(0, 1fr));
  min-height: 24px;
  align-items: center;
  padding: 0 22px 7px;
}

.workflow-stage-rail::before {
  content: "";
  position: absolute;
  right: calc(22px + (100% - 44px) / (var(--stage-count) * 2));
  bottom: 12px;
  left: calc(22px + (100% - 44px) / (var(--stage-count) * 2));
  height: 2px;
  background: #424b4a;
}

.workflow-stage-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.workflow-stage-node i {
  display: block;
  width: 11px;
  height: 11px;
  background: #414a49;
  border: 2px solid var(--panel);
  border-radius: 50%;
  box-shadow: 0 0 0 1px #414a49;
}

.workflow-stage-node.completed i {
  background: #75aa83;
  box-shadow: 0 0 0 1px #75aa83;
}

.workflow-stage-node.active i {
  background: #b7c94e;
  box-shadow: 0 0 0 1px #8ea036, 0 0 8px rgba(183, 201, 78, 0.42);
  animation: workflow-lamp-pulse 2.6s ease-in-out infinite;
}

.workflow-stage-node.rejected i {
  background: #cf5b53;
  box-shadow: 0 0 0 1px #cf5b53, 0 0 7px rgba(207, 91, 83, 0.25);
}

.workflow-stage-node.cancelled i {
  background: #676e6c;
  box-shadow: 0 0 0 1px #676e6c;
}

@keyframes workflow-lamp-pulse {
  0%, 100% { opacity: 0.72; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .workflow-stage-node.active i {
    animation: none;
  }
}

.workflow-request-details,
.workflow-task-details {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
}

.workflow-stage-list {
  display: grid;
  gap: 5px;
}

.workflow-stage-detail {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 6px 8px;
  border-left: 3px solid #4b5452;
}

.workflow-stage-detail.completed { border-left-color: #75aa83; }
.workflow-stage-detail.active { border-left-color: #b7c94e; }
.workflow-stage-detail.rejected { border-left-color: #cf5b53; }

.stage-detail-index {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--muted);
  background: var(--panel);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}

.workflow-stage-detail > div {
  display: grid;
  gap: 2px;
}

.workflow-stage-detail small,
.workflow-stage-detail em,
.workflow-stage-detail > span:last-child {
  color: var(--muted);
  font-size: 11px;
}

.workflow-stage-detail em {
  color: var(--teal);
  font-style: normal;
}

.workflow-stage-detail > span:last-child {
  font-weight: 800;
  white-space: nowrap;
}

.workflow-history {
  display: grid;
  gap: 5px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.workflow-history > div {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.workflow-actions button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 800;
}

.workflow-actions .danger-action {
  color: var(--red);
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 30%, var(--line));
}

.workflow-task-title {
  display: flex;
  align-items: flex-start;
}

.workflow-task-title > span {
  min-width: 0;
}

.workflow-rail-row td {
  padding: 0 10px 3px;
  background: color-mix(in srgb, var(--surface-soft) 52%, transparent);
}

.workflow-rail-row .workflow-stage-rail {
  padding-right: 5%;
  padding-left: 5%;
}

.workflow-rail-row .workflow-stage-rail::before {
  right: calc(5% + (90% / (var(--stage-count) * 2)));
  left: calc(5% + (90% / (var(--stage-count) * 2)));
}

.workflow-task-details-row td {
  padding: 0;
}

.workflow-task-details {
  padding: 12px 5%;
}

.lower {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.panel {
  padding: 14px;
  margin-bottom: 14px;
  overflow: hidden;
}

.compact-panel {
  padding-bottom: 14px;
}

.status-sticky {
  position: sticky;
  top: 88px;
  z-index: 30;
  backdrop-filter: blur(10px);
}

.panel-title {
  margin-bottom: 14px;
}

.collapsible-panel.collapsed .panel-title {
  margin-bottom: 0;
}

.collapsible-panel.collapsed .panel-body,
.collapsible-panel.collapsed .collapsible-extra {
  display: none;
}

.panel-collapse-toggle {
  min-height: 30px;
  padding: 0 10px;
  color: var(--teal);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.panel-collapse-toggle:hover {
  border-color: #8bc7bf;
  box-shadow: 0 0 0 3px rgba(24, 117, 111, 0.12);
}

.gantt-head {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.gantt-controls {
  position: relative;
  display: inline-grid;
  grid-template-columns: 34px auto auto 34px;
  gap: 6px;
  align-items: center;
}

.gantt-controls button {
  min-height: 32px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.gantt-controls button:hover {
  border-color: var(--teal);
}

.gantt-controls #gantt-current {
  padding: 0 11px;
  font-size: 12px;
}

.gantt-controls #gantt-period {
  padding: 0 11px;
  font-size: 12px;
}

.period-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.period-popover label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.period-popover input {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.period-popover div {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.period-popover div button {
  min-height: 32px;
  padding: 0 10px;
}

.bars {
  display: grid;
  gap: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr) 66px;
  gap: 12px;
  align-items: center;
}

.bar-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-name.inactive {
  color: #7d817d;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  background: rgba(142, 162, 184, 0.18);
  border-radius: 4px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.bar-value {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.bar-value small {
  display: block;
  font-size: 10px;
}

.deadline-panel {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.status-board {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-type {
  display: grid;
  grid-template-columns: minmax(88px, auto) auto;
  gap: 4px 9px;
  align-items: center;
  min-height: 52px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-type.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(24, 117, 111, 0.14);
}

.status-type.off {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.status-type strong {
  font-size: 13px;
}

.status-type span {
  display: inline-grid;
  min-width: 24px;
  min-height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-type small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-type.done span,
.status-type.closed span {
  color: #28713d;
  background: var(--green-soft);
}

.status-type.progress span,
.status-type.review span {
  color: #23567f;
  background: var(--blue-soft);
}

.status-type.waiting span,
.status-type.hold span {
  color: #875a15;
  background: var(--amber-soft);
}

.status-type.rejected span,
.status-type.canceled span {
  color: #9c3f31;
  background: var(--red-soft);
}

.ring {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
}

.ring::after {
  content: attr(data-total);
  position: absolute;
  inset: 29px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 30px;
  font-weight: 900;
}

.legend {
  display: grid;
  gap: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.gantt {
  display: grid;
  gap: 8px;
}

.gantt.dragging {
  cursor: grabbing;
  user-select: none;
}

.gantt-window {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 16px;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 8px;
  background:
    linear-gradient(90deg, rgba(24, 117, 111, 0.1), rgba(197, 138, 46, 0.12)),
    var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: grab;
}

.gantt-window:hover .mouse-watermark {
  opacity: 0.28;
}

.mouse-watermark {
  position: absolute;
  top: 50%;
  right: 46px;
  width: 22px;
  height: 32px;
  pointer-events: none;
  border: 2px solid var(--ink);
  border-radius: 12px;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.15s ease;
}

.mouse-watermark::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  width: 2px;
  height: 7px;
  background: var(--ink);
  border-radius: 2px;
  transform: translateX(-50%);
}

.gantt-window strong {
  display: block;
  font-size: 14px;
}

.gantt-window span {
  color: var(--muted);
  font-size: 12px;
}

.gantt-handle {
  position: relative;
  width: 16px;
  min-height: 30px;
  padding: 0;
  background: var(--teal);
  border: 0;
  border-radius: 4px;
  cursor: ew-resize;
}

.gantt-handle.end {
  background: var(--amber);
}

.gantt-handle::after {
  position: absolute;
  top: 50%;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity 0.15s ease;
}

.gantt-handle.start::after {
  content: "<<";
  left: 20px;
}

.gantt-handle.end::after {
  content: ">>";
  right: 20px;
}

.gantt-handle:hover::after {
  opacity: 0.35;
}

.gantt-axis,
.gantt-row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 12px;
}

.axis-line {
  display: flex;
  justify-content: space-between;
  padding-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.gantt-row {
  align-items: center;
  min-height: 38px;
}

.gantt-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-title a,
.task-title a {
  color: var(--ink);
  text-decoration: none;
}

.gantt-title a:hover,
.task-title a:hover {
  color: #0d5f58;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gantt-meta {
  color: var(--muted);
  font-size: 12px;
}

.person-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.person-chip {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 0 7px;
  color: #23433f;
  background: rgba(24, 117, 111, 0.1);
  border: 1px solid rgba(24, 117, 111, 0.2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.person-chip.inactive {
  color: #6c706d;
  background: #ece9e2;
  border-color: #d2cdc2;
}

.assignment-mode {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  color: #875a15;
  background: var(--amber-soft);
  border: 1px solid #e3c985;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.person-icon {
  position: relative;
  width: 13px;
  height: 14px;
  flex: 0 0 auto;
}

.person-icon::before,
.person-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.person-icon::before {
  top: 1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.person-icon::after {
  bottom: 1px;
  width: 11px;
  height: 6px;
  border-radius: 6px 6px 2px 2px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 260px;
}

.tag-chip {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  color: #5d4320;
  background: #f5e4c0;
  border: 1px solid #e7cf9a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border-style: solid;
  cursor: pointer;
}

.tag-chip:hover {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(197, 138, 46, 0.12);
}

.tag-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  gap: 9px;
  width: 310px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tag-menu-title {
  font-weight: 900;
}

.tag-menu > button,
.tag-menu-row button {
  min-height: 32px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 800;
}

.tag-menu label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tag-menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.tag-menu input {
  min-height: 32px;
  min-width: 0;
  padding: 0 8px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.tag-menu .danger-action {
  color: #9c3f31;
  background: var(--red-soft);
  border-color: #e7beb6;
}

.lane {
  position: relative;
  min-height: 28px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc(25% - 1px),
      rgba(23, 33, 30, 0.08) calc(25% - 1px),
      rgba(23, 33, 30, 0.08) 25%
    );
  border-radius: 6px;
}

.today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
}

.task-bar {
  position: absolute;
  top: 6px;
  min-width: 7px;
  height: 16px;
  border-radius: 4px;
  background: var(--teal);
}

.task-bar.high {
  background: var(--red);
}

.task-bar.medium {
  background: var(--amber);
}

.task-bar.clipped-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.task-bar.clipped-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.sla {
  display: grid;
  gap: 8px;
}

.sla-note {
  padding: 10px;
  color: #f0d083;
  background: var(--amber-soft);
  border-radius: 8px;
  font-size: 13px;
}

.sla-row {
  display: grid;
  grid-template-columns: 84px repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sla-cell {
  min-height: 58px;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sla-cell strong {
  font-size: 22px;
}

.deps {
  display: grid;
  gap: 10px;
}

.dep-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.dep-node {
  min-width: 0;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dep-node strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dep-node span {
  color: var(--muted);
  font-size: 12px;
}

.arrow {
  color: var(--muted);
  text-align: center;
}

.portal-grid {
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
}

.org-panel {
  grid-column: 1 / -1;
}

.portal-native-panel {
  border-color: #9fcfc8;
}

.service-catalog-panel {
  border-color: #d8bd79;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.service-card {
  display: grid;
  align-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 132px;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-card:hover,
.service-card.active {
  background: var(--teal-soft);
  border-color: #8bc7bf;
  box-shadow: 0 0 0 3px rgba(24, 117, 111, 0.1);
}

.service-card div {
  display: grid;
  gap: 6px;
}

.service-card strong {
  font-size: 15px;
}

.service-card span,
.service-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.service-card small {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  color: #5d4320;
  background: var(--amber-soft);
  border: 1px solid #e7cf9a;
  border-radius: 999px;
  font-weight: 900;
}

.request-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 12px;
  margin-top: 12px;
}

.request-form-panel,
.request-list-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.request-preview {
  display: grid;
  grid-template-columns: minmax(140px, 0.35fr) minmax(140px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  background: rgba(14, 58, 50, 0.38);
  border: 1px solid rgba(24, 211, 152, 0.18);
  border-radius: 8px;
}

.request-preview div {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px solid rgba(24, 211, 152, 0.16);
  border-radius: 7px;
}

.route-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.request-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.portal-request-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.portal-request-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.portal-request-form input,
.portal-request-form select,
.portal-request-form textarea {
  min-height: 36px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.portal-request-form textarea {
  resize: vertical;
}

.portal-request-form .wide-field,
.portal-request-form .form-actions {
  grid-column: span 3;
}

.portal-request-list {
  display: grid;
  gap: 8px;
}

.request-item {
  display: grid;
  gap: 8px;
  padding: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.request-item strong,
.request-item span {
  display: block;
}

.request-item > div:first-child span,
.request-item small {
  color: var(--muted);
  font-size: 12px;
}

.request-route {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.request-task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.request-task-chips span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  color: #5d4320;
  background: var(--amber-soft);
  border: 1px solid #e7cf9a;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.request-item-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.request-item-footer button {
  min-height: 28px;
  padding: 0 8px;
  color: #9c3f31;
  background: var(--red-soft);
  border: 1px solid #e6beb4;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
}

.compact-title {
  margin-bottom: 0;
}

.portal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
}

.text-link {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  white-space: nowrap;
}

.text-link:hover {
  color: #0d4d3f;
  border-bottom-style: solid;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segmented button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  color: var(--teal);
  background: var(--teal-soft);
}

.portal-actions input {
  min-height: 40px;
  min-width: 260px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.primary-action {
  min-height: 42px;
  padding: 0 14px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--dark-2), var(--dark));
  border: 1px solid rgba(11, 33, 54, 0.88);
  border-radius: 8px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(3, 29, 67, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary-action:hover {
  background: linear-gradient(180deg, #183f5d, var(--dark));
}

.primary-action:active {
  transform: scale(0.98);
  box-shadow: 0 7px 18px rgba(3, 29, 67, 0.2);
}

.department-tree.bucket-tree {
  display: grid;
  gap: 7px;
}

.department-tree.classic-tree {
  overflow-x: auto;
}

.tree-table {
  min-width: 620px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tree-header,
.tree-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 0.58fr) 108px;
  gap: 10px;
  align-items: center;
}

.tree-header {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.tree-row {
  min-height: 32px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}

.tree-row:last-child {
  border-bottom: 0;
}

.tree-row:hover,
.tree-row.active {
  background: var(--teal-soft);
}

.portal-tree-table {
  min-width: 780px;
}

.portal-department-header,
.portal-department-row {
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.9fr) 88px;
}

.portal-department-row {
  min-height: 40px;
}

.tree-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.tree-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-name-text {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.tree-name-text small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-head {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.tree-head .head-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-head small,
.empty-head {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-indent {
  width: calc(var(--level) * 18px);
  min-width: calc(var(--level) * 18px);
  align-self: stretch;
  border-left: calc(min(var(--level), 1) * 1px) solid #ddd2c2;
}

.tree-toggle {
  display: inline-grid;
  width: 18px;
  height: 18px;
  min-width: 18px;
  place-items: center;
  padding: 0;
  color: var(--teal);
  background: var(--panel);
  border: 1px solid #cfc2ae;
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.tree-toggle.placeholder {
  background: transparent;
  border-color: transparent;
}

.tree-actions {
  display: inline-flex;
  gap: 6px;
}

.tree-actions button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--teal);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.mapping-chips,
.external-link-list {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px;
}

.mapping-chip,
.external-link-list span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid #bfe1dc;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.external-link-list .bitrix {
  color: #23567f;
  background: var(--blue-soft);
  border-color: #c6dced;
}

.external-link-list .google {
  color: #66470d;
  background: var(--amber-soft);
  border-color: rgba(168, 112, 22, 0.42);
}

.row-actions {
  text-align: right;
}

.department-node {
  display: grid;
  gap: 7px;
  margin-left: calc(var(--level) * 18px);
}

.department-node button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.department-node button:hover,
.department-node button.active {
  background: var(--teal-soft);
  border-color: #8bc7bf;
}

.department-node strong,
.department-node small {
  display: block;
}

.department-node small,
.department-counts small {
  color: var(--muted);
  font-size: 11px;
}

.department-counts {
  min-width: 52px;
  text-align: right;
}

.access-panel {
  border-color: #bfd7d2;
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.access-card {
  display: grid;
  gap: 6px;
  min-height: 104px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.access-card strong {
  font-size: 14px;
}

.access-card span,
.access-flow span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.access-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.access-flow div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  background: rgba(14, 58, 50, 0.38);
  border: 1px solid rgba(24, 211, 152, 0.18);
  border-radius: 8px;
}

.access-flow b {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fffaf1;
  background: var(--teal);
  border-radius: 50%;
  font-size: 12px;
}

.external-people,
.external-users-preview {
  display: grid;
  gap: 8px;
}

.external-person {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px;
  color: inherit;
  text-align: left;
  text-decoration: none;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.external-person.birthday {
  background: linear-gradient(135deg, var(--amber-soft), var(--surface-strong) 58%, var(--teal-soft));
  border-color: #d6a746;
  box-shadow: inset 4px 0 0 #d49a25;
}

.external-person.inactive {
  color: #7c8795;
  background: color-mix(in srgb, var(--surface-soft) 76%, #727b82 24%);
}

.external-person span,
.external-person small {
  color: var(--muted);
  font-size: 12px;
}

.person-card-name,
.person-table-name {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

body.employee-profile-open {
  overflow: hidden;
}

.employee-profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  justify-content: flex-end;
}

.employee-profile-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(4, 14, 24, 0.56);
  border: 0;
  border-radius: 0;
  backdrop-filter: blur(3px);
}

.employee-profile-drawer {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 300px));
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface-strong);
  border-left: 1px solid color-mix(in srgb, var(--teal) 42%, var(--line));
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.22);
  animation: employee-profile-slide-in 180ms ease-out;
}

@keyframes employee-profile-slide-in {
  from { transform: translateX(34px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}

.employee-profile-header {
  min-height: 128px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  color: #f5fbfb;
  background:
    linear-gradient(110deg, rgba(14, 97, 87, 0.96), rgba(16, 53, 72, 0.98));
}

.employee-profile-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.employee-profile-heading > div:last-child {
  min-width: 0;
}

.employee-profile-heading h2,
.employee-profile-heading p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-profile-heading h2 {
  margin-top: 3px;
  font-size: clamp(21px, 2vw, 28px);
  letter-spacing: 0;
}

.employee-profile-heading p {
  color: rgba(245, 251, 251, 0.72);
  font-size: 12px;
}

.employee-profile-avatar {
  position: relative;
  display: grid;
  width: 66px;
  height: 66px;
  flex: 0 0 66px;
  place-items: center;
  overflow: hidden;
  color: var(--dark);
  background: #edf4f1;
  border: 2px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 900;
}

.employee-profile-avatar img,
.employee-profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-profile-presence {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  color: rgba(245, 251, 251, 0.72);
  font-size: 11px;
}

.employee-profile-presence .presence-badge {
  margin-left: 0;
}

.employee-profile-close {
  flex: 0 0 auto;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.employee-profile-tabs {
  min-height: 54px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 18px 0;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.employee-profile-tabs::-webkit-scrollbar {
  display: none;
}

.employee-profile-tabs button {
  min-width: max-content;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
}

.employee-profile-tabs button.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.employee-profile-content {
  height: calc(100dvh - 182px);
  overflow-y: auto;
  padding: 20px;
  background: color-mix(in srgb, var(--bg) 72%, var(--surface-strong) 28%);
}

.employee-profile-overview {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(300px, 1.35fr);
  gap: 14px;
}

.employee-profile-summary,
.employee-profile-facts-card,
.employee-profile-section {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-small);
}

.employee-profile-summary {
  align-self: start;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 22px 16px 18px;
  text-align: center;
}

.employee-profile-summary > span {
  color: var(--muted);
  font-size: 13px;
}

.employee-profile-photo {
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
  overflow: hidden;
  margin-bottom: 7px;
  color: var(--ink);
  background: var(--blue-soft);
  border: 3px solid var(--surface-strong);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
  font-size: 28px;
  font-weight: 900;
}

.employee-contact-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 14px;
}

.employee-contact-actions button,
.employee-contact-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--teal);
  text-decoration: none;
  background: var(--teal-soft);
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--line));
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
}

.employee-contact-actions button:only-child {
  grid-column: 1 / -1;
}

.employee-contact-actions button:disabled {
  color: var(--muted);
  background: var(--surface-soft);
  opacity: 0.62;
}

.employee-profile-facts-card {
  padding: 20px;
}

.employee-profile-facts-card h3,
.employee-profile-section h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.employee-profile-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin: 14px 0 0;
}

.employee-profile-facts > div {
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.employee-profile-facts dt {
  color: var(--muted);
  font-size: 11px;
}

.employee-profile-facts dd {
  overflow-wrap: anywhere;
  margin: 3px 0 0;
  font-weight: 750;
}

.employee-profile-facts a,
.employee-source-link {
  color: var(--blue);
  text-decoration: none;
}

.employee-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 900;
}

.employee-source-link .ui-icon {
  width: 15px;
  height: 15px;
}

.employee-profile-section {
  margin-top: 14px;
  padding: 18px;
}

.employee-profile-section.profile-tab-section {
  margin-top: 0;
}

.employee-profile-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.employee-profile-section-title > span {
  min-width: 28px;
  padding: 4px 7px;
  color: var(--teal);
  text-align: center;
  background: var(--teal-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.employee-task-list {
  display: grid;
  gap: 7px;
}

.employee-task-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.employee-task-item:first-child {
  border-top: 0;
}

.employee-task-item > div {
  min-width: 0;
}

.employee-task-item > div:last-child {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.employee-task-item strong,
.employee-task-item small,
.employee-task-item time {
  display: block;
}

.employee-task-item strong {
  overflow-wrap: anywhere;
}

.employee-task-item small,
.employee-task-item time {
  color: var(--muted);
  font-size: 11px;
}

.profile-private-state {
  padding: 26px 14px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: 7px;
}

.employee-message-form {
  width: 100%;
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  text-align: left;
  border-top: 1px solid var(--line);
}

.employee-message-form label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.employee-message-form textarea {
  width: 100%;
  resize: vertical;
}

.employee-message-status {
  margin: 0;
  color: var(--green);
  font-size: 12px;
}

.profile-calendar-weekdays,
.profile-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.profile-calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.profile-calendar-day {
  position: relative;
  min-width: 0;
  min-height: 64px;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 7px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.profile-calendar-day.empty-day {
  visibility: hidden;
}

.profile-calendar-day.today {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.profile-calendar-day.birthday {
  background: var(--amber-soft);
}

.profile-calendar-day small {
  overflow: hidden;
  color: var(--amber);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-calendar-day i {
  position: absolute;
  right: 5px;
  bottom: 5px;
  min-width: 18px;
  min-height: 18px;
  display: grid;
  place-items: center;
  color: var(--surface-strong);
  background: var(--teal);
  border-radius: 50%;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.profile-calendar-agenda {
  margin-top: 18px;
}

.employee-success-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 9px;
}

.employee-success-grid > div {
  min-height: 94px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.employee-success-grid span,
.employee-metric-note,
.achievement-list span {
  color: var(--muted);
  font-size: 11px;
}

.employee-success-grid strong {
  font-size: 25px;
}

.employee-metric-note {
  margin: 0 0 20px;
}

.achievement-list {
  display: grid;
  gap: 7px;
}

.achievement-list article {
  display: grid;
  gap: 3px;
  padding: 12px;
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 32%, var(--line));
  border-radius: 7px;
}

.birthday-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  color: #6a4100 !important;
  background: #ffe7a6;
  border: 1px solid #ddb75c;
  border-radius: 999px;
  font-size: 11px !important;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.birthday-row {
  background: rgba(75, 54, 16, 0.42);
}

.birthday-row td {
  border-bottom-color: #e5c978;
}

.employee-editor {
  border-color: rgba(22, 119, 95, 0.26);
  overflow: visible;
}

.icon-action {
  display: inline-grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  place-items: center;
  padding: 0 !important;
}

.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  pointer-events: none;
}

.employee-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.employee-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.employee-form input,
.employee-form select,
.employee-form textarea {
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  outline: 0;
}

.employee-form input:focus,
.employee-form select:focus,
.employee-form textarea:focus {
  border-color: rgba(22, 119, 95, 0.55);
  box-shadow: 0 0 0 4px rgba(22, 119, 95, 0.1);
}

.employee-form select[multiple] {
  min-height: 112px;
}

.employee-form textarea {
  resize: vertical;
}

.employee-form label:has(textarea),
.employee-form .wide-field,
.form-actions {
  grid-column: span 3;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.form-actions button,
#employee-editor-close,
#portal-department-editor-close,
td button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.employee-profile-form {
  grid-template-columns: 1fr;
  gap: 0;
}

.employee-identity-section {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--line);
}

.avatar-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.employee-avatar-preview {
  position: relative;
  display: grid;
  width: 148px;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line));
  border-radius: 8px;
}

.employee-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-avatar-preview .ui-icon {
  width: 62px;
  height: 62px;
  opacity: 0.52;
}

.avatar-upload-action {
  display: inline-flex !important;
  width: 148px;
  min-height: 38px;
  justify-content: center;
  align-items: center;
  gap: 7px !important;
  color: var(--teal) !important;
  background: var(--surface-strong);
  border: 1px solid color-mix(in srgb, var(--teal) 32%, var(--line));
  border-radius: 8px;
  cursor: pointer;
}

.avatar-url-field {
  max-width: 220px;
}

.avatar-url-field > span,
.employee-form label > span:first-child {
  display: flex;
  gap: 6px;
  align-items: center;
}

.field-hint,
.field-error {
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.field-error:not(:empty) {
  color: var(--red);
}

.employee-form input.invalid,
.employee-form .iti:has(input.invalid) {
  border-color: var(--red);
}

.identity-fields {
  display: grid;
  gap: 16px;
  align-content: start;
}

.employee-name-grid,
.employee-contact-grid,
.employee-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.employee-contact-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gender-picker,
.check-list-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.gender-picker legend,
.check-list-field legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.gender-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gender-picker legend {
  width: 100%;
}

.gender-picker label {
  display: block;
}

.gender-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.gender-picker label > span {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--control-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.gender-picker label > span b {
  font-size: 11px;
}

.gender-picker input:checked + span {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line));
}

.employee-form-section {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.employee-form-section > header {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  align-content: start;
  color: var(--teal);
}

.employee-form-section h4,
.employee-form-section p {
  margin: 0;
}

.employee-form-section h4 {
  color: var(--ink);
  font-size: 15px;
}

.employee-form-section p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.employee-form-section .wide-field {
  grid-column: span 3;
}

.password-field {
  position: relative;
  display: block !important;
}

.password-field input {
  width: 100%;
  padding-right: 46px;
}

.field-icon-button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.field-icon-button:hover {
  color: var(--teal);
  background: var(--teal-soft);
}

.access-fields {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.check-list-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
}

.check-list-field label {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.check-list-field input {
  width: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--teal);
}

.employee-device-summary {
  min-height: 54px;
  padding: 11px 13px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.employee-device-summary .device-list {
  margin-top: 0;
}

.employee-profile-form .form-actions {
  grid-column: auto;
  padding-top: 18px;
}

.employee-form-message {
  margin-top: 14px;
  padding: 10px 12px;
  color: #8f302b;
  background: var(--red-soft);
  border: 1px solid color-mix(in srgb, var(--red) 36%, var(--line));
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.employee-profile-form .form-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.employee-profile-form .form-actions .primary-action {
  color: #fff;
  background: linear-gradient(180deg, var(--dark-2), var(--dark));
  border-color: rgba(11, 33, 54, 0.88);
}

.employee-profile-form .iti {
  width: 100%;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.employee-profile-form .iti input {
  width: 100%;
  border: 0;
}

.employee-profile-form .iti input:focus {
  box-shadow: none;
}

.employee-profile-form .iti:focus-within {
  border-color: rgba(22, 119, 95, 0.55);
  box-shadow: 0 0 0 4px rgba(22, 119, 95, 0.1);
}

.iti__dropdown-content,
.flatpickr-calendar {
  color: var(--ink);
  background: var(--surface-strong);
  border-color: var(--line);
  box-shadow: var(--shadow-small);
}

.iti__country-list {
  max-width: min(420px, calc(100vw - 32px));
}

.flatpickr-day,
.flatpickr-weekday,
.flatpickr-current-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  color: var(--ink);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.device-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.device-list span,
.external-source span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  color: #23567f;
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.external-source {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.external-source div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: rgba(5, 14, 24, 0.94);
  font-size: 12px;
  text-transform: uppercase;
}

.sort-button {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 28px;
  padding: 0;
  color: inherit;
  text-align: left;
  text-transform: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.sort-button:hover,
.sort-button.active {
  color: var(--blue);
}

.sort-button.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.task-title {
  font-weight: 900;
}

.task-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.notion {
  background: var(--teal-soft);
  color: var(--teal);
}

.bitrix {
  background: var(--blue-soft);
  color: var(--blue);
}

.portal {
  background: var(--violet-soft);
  color: var(--violet);
}

.google {
  background: var(--amber-soft);
  color: var(--amber);
}

.ok {
  background: var(--green-soft);
  color: var(--green);
}

.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.danger {
  background: var(--red-soft);
  color: #9c3f31;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 110;
    width: 100%;
    height: auto;
    padding: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 0;
  }

  .sidebar-brand,
  .nav-section {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 6px;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav button {
    min-width: 126px;
    flex: 1 0 auto;
  }

  .workspace {
    padding-bottom: 92px;
  }

  .statistics-kpis {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .employee-profile-drawer {
    width: min(760px, calc(100vw - 92px));
  }
}

@media (max-width: 920px) {
  .hero,
  .panel-title {
    flex-direction: column;
  }

  .filters,
  .metrics,
  .grid,
  .lower,
  .home-grid,
  .dashboard-shell,
  .employee-dashboard,
  .home-work-grid,
  .home-kpi-grid,
  .portal-grid,
  .auth-shell,
  .session-policy-grid,
  .data-grid,
  .sync-layout,
  .sync-status,
  .service-grid,
  .request-workbench,
  .request-preview,
  .portal-request-form,
  .access-grid,
  .access-flow,
  .access-request-form,
  .employee-form {
    grid-template-columns: 1fr 1fr;
  }

  .employee-profile-form {
    grid-template-columns: 1fr;
  }

  .statistics-layout {
    grid-template-columns: 1fr;
  }

  .new-service-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .vacation-route-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-identity-section,
  .employee-form-section {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .employee-name-grid,
  .employee-contact-grid,
  .employee-section-grid,
  .access-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-contact-grid .wide-field,
  .employee-form-section .wide-field {
    grid-column: span 2;
  }

  .dashboard-people-panel {
    min-height: auto;
    max-height: 520px;
  }

  .employee-form label:has(textarea),
  .employee-form .wide-field,
  .portal-request-form .wide-field,
  .portal-request-form .form-actions,
  .access-request-form .wide-field,
  .access-request-form .form-actions,
  .form-actions {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  body {
    background-attachment: scroll;
  }

  .topbar {
    min-height: 60px;
    grid-template-columns: 1fr;
    padding: 0 10px;
    align-items: center;
  }

  .topbar-search,
  .topbar-icon-button {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .top-workday-timer {
    min-width: 88px;
    padding: 0 8px;
    font-size: 12px;
  }

  .top-user-name {
    display: none;
  }

  .employee-profile-drawer {
    width: 100vw;
    border-left: 0;
  }

  .employee-profile-header {
    min-height: 112px;
    padding: 16px;
  }

  .employee-profile-avatar {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
  }

  .employee-profile-tabs {
    padding-inline: 8px;
  }

  .employee-profile-content {
    height: calc(100dvh - 166px);
    padding: 12px;
  }

  .employee-profile-overview,
  .employee-profile-facts,
  .employee-success-grid {
    grid-template-columns: 1fr;
  }

  .employee-task-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-task-item > div:last-child {
    display: flex;
    justify-content: space-between;
    justify-items: initial;
  }

  .profile-calendar-day {
    min-height: 48px;
    padding: 5px;
  }

  .workspace {
    width: min(100% - 24px, 1320px);
    padding: 18px 0 72px;
  }

  .filters,
  .metrics,
  .grid,
  .lower,
  .home-grid,
  .dashboard-shell,
  .employee-dashboard,
  .home-work-grid,
  .home-kpi-grid,
  .home-action-grid,
  .deadline-panel,
  .portal-grid,
  .auth-shell,
  .session-policy-grid,
  .data-grid,
  .sync-layout,
  .sync-actions,
  .sync-status,
  .service-grid,
  .request-workbench,
  .request-preview,
  .portal-request-form,
  .access-grid,
  .access-flow,
  .access-request-form,
  .employee-form,
  .new-task-form,
  .statistics-kpis {
    grid-template-columns: 1fr;
  }

  .employee-profile-form,
  .employee-identity-section,
  .employee-form-section,
  .employee-name-grid,
  .employee-contact-grid,
  .employee-section-grid,
  .access-fields {
    grid-template-columns: 1fr;
  }

  .avatar-editor {
    align-items: center;
  }

  .avatar-url-field {
    width: 100%;
    max-width: none;
  }

  .employee-form-section > header {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .employee-contact-grid .wide-field,
  .employee-form-section .wide-field {
    grid-column: span 1;
  }

  .check-list-field {
    grid-template-columns: 1fr;
  }

  .employee-form label:has(textarea),
  .employee-form .wide-field,
  .portal-request-form .wide-field,
  .portal-request-form .form-actions,
  .access-request-form .wide-field,
  .access-request-form .form-actions,
  .form-actions {
    grid-column: span 1;
  }

  .new-task-form .wide-field {
    grid-column: 1;
  }

  .service-discovery {
    flex-direction: column;
    align-items: stretch;
  }

  .service-search-field {
    min-width: 0;
  }

  .new-service-grid,
  .vacation-request-form,
  .vacation-route-preview,
  .route-override-grid {
    grid-template-columns: 1fr;
  }

  .vacation-request-form .wide-field {
    grid-column: 1;
  }

  .workflow-request-main {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .workflow-status {
    grid-column: 2;
    width: fit-content;
  }

  .workflow-stage-detail {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .workflow-stage-detail > span:last-child {
    grid-column: 2;
  }

  .workflow-history > div {
    grid-template-columns: 1fr;
  }

  .statistics-bar {
    grid-template-columns: 104px minmax(80px, 1fr) 34px;
  }

  .portal-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .portal-actions input {
    min-width: 0;
    width: 100%;
  }

  .bar-row,
  .gantt-axis,
  .gantt-row,
  .sla-row {
    grid-template-columns: 1fr;
  }

  .gantt-head {
    justify-items: stretch;
    width: 100%;
  }

  .gantt-controls {
    grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr) 34px;
  }

  .period-popover {
    left: 0;
    right: auto;
  }
}
