:root {
  color-scheme: light;
  --bg: #eef3f2;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --ink: #17212b;
  --muted: #68737d;
  --line: #dbe3e1;
  --accent: #0e766e;
  --accent-strong: #095f59;
  --success: #176a4f;
  --warning: #ad5f00;
  --danger: #a33b45;
  --shadow: 0 18px 60px rgba(30, 43, 54, 0.12);
  --field-bg: #ffffff;
  --readonly-bg: #eef3f2;
  --secondary-bg: #e5ecea;
  --section-bg: #eef6f4;
  --sidebar-bg: #8F9593;
  --sidebar-ink: #111820;
  --sidebar-muted: #2f3738;
  --sidebar-line: rgba(17, 24, 32, 0.18);
  --sidebar-button-bg: rgba(255, 255, 255, 0.18);
  --sidebar-button-hover: rgba(255, 255, 255, 0.28);
  --sidebar-active-bg: rgba(5, 5, 5, 0.14);
  --calendar-workday-bg: #ffffff;
  --calendar-weekend-bg: #e7ebee;
  --calendar-weekend-ink: #65717a;
  --calendar-convention-bg: #fff3b8;
  --calendar-convention-line: #e7c84f;
  --calendar-holiday-bg: #ffd9dc;
  --calendar-holiday-line: #e87881;
  --calendar-vacation-bg: #dff3df;
  --calendar-vacation-line: #82c884;
  --calendar-absence-bg: #111820;
  --calendar-mandatory-bg: #ffe0bd;
  --calendar-mandatory-line: #e7a65c;
  --calendar-intensive-bg: #d8ebff;
  --calendar-intensive-line: #82b8f0;
  --danger-bg: #f7e8ea;
  --badge-bg: #edf2f1;
  --badge-ink: #42505a;
  --badge-line: #dce4e2;
  --badge-good-bg: #e2f4ed;
  --badge-good-ink: #176a4f;
  --badge-good-line: #bce4d5;
  --badge-warn-bg: #fff2d8;
  --badge-warn-line: #f2d59b;
  --badge-danger-bg: #ffe1e4;
  --badge-danger-line: #f3a4ac;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b0d;
  --surface: #15181b;
  --surface-2: #202428;
  --ink: #f4f6f5;
  --muted: #aab4b1;
  --line: #30373a;
  --accent: #6bc4b8;
  --accent-strong: #9ce0d7;
  --success: #83d6ae;
  --warning: #e7aa50;
  --danger: #ff7d8a;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  --field-bg: #1b1f23;
  --readonly-bg: #22282c;
  --secondary-bg: #2a3034;
  --section-bg: #1d2a2b;
  --sidebar-bg: #0f1114;
  --sidebar-ink: #f4f6f5;
  --sidebar-muted: #aab4b1;
  --sidebar-line: rgba(255, 255, 255, 0.14);
  --sidebar-button-bg: rgba(255, 255, 255, 0.07);
  --sidebar-button-hover: rgba(255, 255, 255, 0.13);
  --sidebar-active-bg: rgba(255, 255, 255, 0.16);
  --calendar-workday-bg: #15181b;
  --calendar-weekend-bg: #252a2f;
  --calendar-weekend-ink: #aab4b1;
  --calendar-convention-bg: #5d4815;
  --calendar-convention-line: #97782b;
  --calendar-holiday-bg: #602830;
  --calendar-holiday-line: #a24b57;
  --calendar-vacation-bg: #1f4b34;
  --calendar-vacation-line: #3f865f;
  --calendar-absence-bg: #050505;
  --calendar-mandatory-bg: #5c3518;
  --calendar-mandatory-line: #9a6636;
  --calendar-intensive-bg: #1e3d5c;
  --calendar-intensive-line: #3f76a6;
  --danger-bg: #3a1d22;
  --badge-bg: #22282c;
  --badge-ink: #d5dcda;
  --badge-line: #374046;
  --badge-good-bg: #193a2a;
  --badge-good-ink: #9ee0bd;
  --badge-good-line: #2b6848;
  --badge-warn-bg: #3d2d14;
  --badge-warn-line: #755a23;
  --badge-danger-bg: #442128;
  --badge-danger-line: #87424c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.lock-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(23, 33, 43, 0.72), rgba(23, 33, 43, 0.72)),
    url("https://images.unsplash.com/photo-1450101499163-c8848c66ca85?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.lock-panel {
  width: min(430px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow);
}

[data-theme="dark"] .lock-panel {
  background: rgba(21, 24, 27, 0.94);
  border-color: rgba(255, 255, 255, 0.14);
}

.lock-panel h1 {
  margin: 18px 0 8px;
  font-size: 30px;
}

.lock-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.45;
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.lock-logo {
  width: min(210px, 100%);
  height: auto;
  margin-bottom: 18px;
  border-radius: 6px;
}

.icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stack {
  display: grid;
  gap: 16px;
}

.lock-status {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.lock-reset {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.lock-reset span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

select[multiple] {
  min-height: 142px;
}

input[readonly] {
  background: var(--readonly-bg);
  color: var(--muted);
  font-weight: 800;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 118, 110, 0.14);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  scrollbar-color: var(--sidebar-line) transparent;
}

.app-title {
  display: grid;
  gap: 12px;
  padding: 0 6px;
}

.sidebar-logo {
  width: min(188px, 100%);
  height: auto;
  border-radius: 6px;
}

.app-title strong {
  display: block;
}

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

.nav-tabs {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-department {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--sidebar-line);
  border-radius: 6px;
  background: var(--sidebar-button-bg);
  color: var(--sidebar-ink);
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.nav-department::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.nav-department:hover {
  background: var(--sidebar-button-hover);
  color: var(--sidebar-ink);
}

.nav-group.nav-collapsed .nav-department::after {
  transform: rotate(-45deg);
}

.nav-group.nav-collapsed .nav-button {
  display: none;
}

.nav-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--sidebar-ink);
  background: transparent;
  text-align: left;
  font-weight: 700;
  margin-left: 8px;
  width: calc(100% - 8px);
}

.nav-button:hover,
.nav-button.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-ink);
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 0;
  font-size: 30px;
}

.top-actions,
.form-actions,
.backup-actions,
.item-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.user-badge {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.primary,
.secondary,
.ghost,
.danger,
.file-button {
  min-height: 40px;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary,
.file-button {
  background: var(--secondary-bg);
  color: var(--ink);
}

.ghost {
  width: 42px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost.is-disabled,
.ghost:disabled {
  cursor: default;
  opacity: 0.42;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.46);
  backdrop-filter: blur(6px);
}

.modal-panel {
  width: min(480px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-panel .compact-form {
  margin-top: 14px;
  padding-top: 0;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.notification-wrap,
.assistant-wrap,
.undo-wrap {
  position: relative;
}

.notification-button {
  position: relative;
}

.undo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.undo-history-button {
  min-height: 40px;
  padding: 10px 12px;
}

.undo-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 22;
  width: min(420px, calc(100vw - 32px));
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px;
}

.undo-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 2px 4px 10px;
}

.undo-panel-header strong {
  display: block;
  font-size: 13px;
}

.undo-panel-header span {
  color: var(--muted);
  font-size: 12px;
}

.undo-item {
  width: 100%;
  display: grid;
  gap: 4px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.undo-item + .undo-item {
  margin-top: 8px;
}

.undo-item strong {
  font-size: 13px;
}

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

.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 900;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: min(360px, calc(100vw - 32px));
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px;
}

.notification-item {
  width: 100%;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px;
  text-align: left;
  display: grid;
  gap: 4px;
}

.notification-item + .notification-item {
  margin-top: 8px;
}

.notification-item strong {
  font-size: 13px;
}

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

.assistant-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 24;
  width: min(460px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 120px));
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.assistant-header strong,
.assistant-header span {
  display: block;
}

.assistant-header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.small-ghost {
  width: 34px;
  min-height: 34px;
}

.small-ghost .icon svg {
  width: 18px;
  height: 18px;
}

.assistant-messages {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  overflow: auto;
}

.assistant-message {
  max-width: 92%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  line-height: 1.45;
}

.assistant-message.user {
  justify-self: end;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.assistant-message.assistant {
  justify-self: start;
}

.assistant-message p {
  margin: 0;
}

.assistant-message p + p {
  margin-top: 8px;
}

.assistant-message strong {
  color: inherit;
}

.assistant-result-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.assistant-result {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.assistant-result strong,
.assistant-key-row strong {
  font-size: 13px;
}

.assistant-result span,
.assistant-key-row span,
.assistant-muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.assistant-answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.assistant-answer-actions button {
  min-height: 32px;
  padding: 7px 10px;
}

.assistant-feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.assistant-feedback button {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.assistant-feedback button.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--section-bg);
}

.assistant-subanswer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.assistant-key-row {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.assistant-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.assistant-form input {
  min-width: 0;
}

.assistant-attach {
  width: 40px;
  min-height: 40px;
  padding: 0;
}

.assistant-attach .icon svg {
  width: 18px;
  height: 18px;
}

.assistant-attachment {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.assistant-attachment button {
  min-height: 24px;
  padding: 3px 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

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

.dashboard-intro {
  margin-bottom: 16px;
  padding: 8px 0 2px;
}

.dashboard-intro h3 {
  margin: 0;
  font-size: 28px;
}

.dashboard-intro p:last-child {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.stat,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(30, 43, 54, 0.05);
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.dashboard-widget {
  display: grid;
  gap: 8px;
  align-content: start;
}

.dashboard-widget small {
  min-height: 34px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

.dashboard-widget button {
  width: fit-content;
  min-height: 34px;
  padding: 8px 12px;
}

.two-column,
.content-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.two-column {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

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

.user-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.panel {
  min-width: 0;
}

.panel-header {
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 17px;
}

.panel-toggle {
  min-height: 34px;
  padding: 7px 10px;
}

.collapsible-panel.panel-collapsed > :not(.panel-header) {
  display: none !important;
}

.collapsible-panel.panel-collapsed .panel-header {
  border-bottom: 0;
}

.collapsible-panel.panel-collapsed .panel-header .inline-field {
  display: none;
}

.collapsible-panel.panel-collapsed .panel-header .search,
.collapsible-panel.panel-collapsed .panel-header .header-tools > :not([data-panel-toggle]) {
  display: none;
}

.subpanel {
  border-top: 1px solid var(--line);
}

.subpanel-header {
  padding: 16px 18px 0;
}

.subpanel-header h4 {
  margin: 0;
  font-size: 15px;
}

.compact-form {
  padding-top: 14px;
}

.batch-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.with-search {
  align-items: center;
}

.header-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.search {
  max-width: 210px;
  padding: 9px 10px;
}

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

.form-section-title {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--section-bg);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.form-section-title:first-of-type {
  margin-top: 0;
}

.section-toggle {
  color: var(--muted);
  font-size: 11px;
  text-transform: none;
}

.section-hidden {
  display: none !important;
}

.permission-hidden {
  display: none !important;
}

.kind-hidden {
  display: none !important;
}

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

.check-card {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  padding: 10px 12px;
  color: var(--ink);
}

.check-card input {
  width: auto;
}

.representative-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px 0 8px;
}

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

.mini-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.mini-item strong {
  display: block;
}

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

.wide {
  grid-column: 1 / -1;
}

.list {
  display: grid;
  gap: 10px;
  padding: 14px;
  max-height: 670px;
  overflow: auto;
}

.work-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.summary-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.compact-list {
  max-height: none;
}

.calendar-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 0 12px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend-box {
  width: 14px;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.year-calendar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.month-calendar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.month-calendar h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.weekday-row,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.weekday-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.calendar-day,
.calendar-empty {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.calendar-day {
  padding: 5px;
  display: grid;
  align-content: start;
  gap: 2px;
  background: var(--calendar-workday-bg);
}

.calendar-day strong {
  font-size: 12px;
}

.calendar-day em {
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.calendar-empty {
  background: transparent;
  border-color: transparent;
}

.calendar-workday {
  background: var(--calendar-workday-bg);
}

.calendar-weekend {
  background: var(--calendar-weekend-bg);
  color: var(--calendar-weekend-ink);
}

.calendar-convenio {
  background: var(--calendar-convention-bg);
  border-color: var(--calendar-convention-line);
}

.calendar-holiday {
  background: var(--calendar-holiday-bg);
  border-color: var(--calendar-holiday-line);
}

.calendar-vacation {
  background: var(--calendar-vacation-bg);
  border-color: var(--calendar-vacation-line);
}

.calendar-absence {
  background: var(--calendar-absence-bg);
  border-color: var(--calendar-absence-bg);
  color: #ffffff;
}

.calendar-mandatory {
  background: var(--calendar-mandatory-bg);
  border-color: var(--calendar-mandatory-line);
}

.calendar-intensive {
  background: var(--calendar-intensive-bg);
  border-color: var(--calendar-intensive-line);
}

.list-item {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 13px;
  display: grid;
  gap: 10px;
}

.list-item.notification-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 111, 103, 0.16);
}

.item-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-main strong {
  display: block;
  overflow-wrap: anywhere;
}

.item-main span,
.item-meta,
.badge {
  color: var(--muted);
  font-size: 12px;
}

.capital-chart {
  display: grid;
  gap: 10px;
}

.capital-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.capital-row strong {
  display: block;
  overflow-wrap: anywhere;
}

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

.capital-card {
  gap: 12px;
}

.capital-bar {
  width: 100%;
  height: 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.capital-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.capital-split {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.capital-split span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.item-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.task-completion-note {
  display: grid;
  gap: 6px;
}

.task-completion-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-completion-note textarea {
  min-height: 64px;
}

.badge {
  background: var(--badge-bg);
  color: var(--badge-ink);
  border: 1px solid var(--badge-line);
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 800;
}

.badge.good {
  background: var(--badge-good-bg);
  color: var(--badge-good-ink);
  border-color: var(--badge-good-line);
}

.badge.warn {
  background: var(--badge-warn-bg);
  color: var(--warning);
  border-color: var(--badge-warn-line);
}

.badge.priority-high {
  background: var(--badge-danger-bg);
  color: var(--danger);
  border-color: var(--badge-danger-line);
}

.badge.priority-medium {
  background: var(--badge-warn-bg);
  color: var(--warning);
  border-color: var(--badge-warn-line);
}

.badge.priority-low {
  background: var(--badge-good-bg);
  color: var(--badge-good-ink);
  border-color: var(--badge-good-line);
}

.time-clock-actions {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.time-clock-actions button {
  min-height: 54px;
  font-size: 16px;
}

.time-location-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.time-location-grid a,
.time-location-grid span {
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 9px 10px;
  text-decoration: none;
}

.inline-danger {
  background: transparent;
  border: 0;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  margin-left: 8px;
  padding: 0;
}

.item-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
}

.check-list,
.backup-actions,
.legal-note {
  padding: 18px;
}

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

.catalog-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.catalog-toolbar label {
  flex: 1;
  min-width: 220px;
}

.catalog-toolbar .search {
  max-width: none;
}

.catalog-settings-stack {
  display: grid;
  gap: 16px;
}

.catalog-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.catalog-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.catalog-group-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.catalog-setting {
  min-width: 0;
}

.catalog-setting textarea {
  min-height: 126px;
}

.compact-empty {
  min-height: 92px;
}

.check-row,
.security-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.check-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.security-item {
  display: grid;
  gap: 6px;
}

.security-item span,
.legal-note span {
  color: var(--muted);
  line-height: 1.45;
}

.legal-note {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
}

.ocr-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ocr-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ocr-status.good {
  color: var(--success);
  font-weight: 800;
}

.ocr-status.warn {
  color: var(--warning);
  font-weight: 800;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

  .sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 14px;
    gap: 14px;
  }

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

  .nav-button {
  justify-content: center;
}

  .stats-grid,
  .two-column,
  .content-grid,
  .user-settings-grid,
  .work-summary,
  .year-calendar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h2 {
    font-size: 24px;
  }

  .nav-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-button {
    font-size: 13px;
    min-height: 42px;
  }

  .form-grid,
  .security-grid,
  .catalog-settings-grid,
  .representative-editor,
  .time-clock-actions,
  .time-location-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    max-width: none;
  }

  .item-main {
    display: grid;
  }

  .assistant-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 84px;
    width: auto;
    max-height: calc(100vh - 104px);
  }

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

@media print {
  body {
    background: #fff;
  }
}
