@media (max-width: 1200px) {
  .app-shell:not(.sidebar-open) .sidebar {
    width: var(--sidebar-collapsed);
  }

  .app-shell:not(.sidebar-open) .sidebar__brand-text,
  .app-shell:not(.sidebar-open) .sidebar__label,
  .app-shell:not(.sidebar-open) .sidebar__user-meta,
  .app-shell:not(.sidebar-open) .sidebar__logout span {
    display: none;
  }

  .app-shell:not(.sidebar-open) .sidebar__brand,
  .app-shell:not(.sidebar-open) .sidebar__link,
  .app-shell:not(.sidebar-open) .sidebar__logout {
    justify-content: center;
  }

  .app-shell:not(.sidebar-open) .sidebar__user {
    justify-content: center;
  }

  .app-shell:not(.sidebar-open) .main-area {
    margin-left: var(--sidebar-collapsed);
  }

  .app-shell.sidebar-open .sidebar {
    width: var(--sidebar-width);
  }

  .app-shell.sidebar-open .main-area {
    margin-left: var(--sidebar-width);
  }

  .topbar__menu-btn {
    display: flex;
  }

  .topbar__user-name {
    display: none;
  }

  .topbar__search {
    width: 148px;
  }

  .topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    grid-template-columns: unset;
  }

  .topbar__start {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 42%;
  }

  .topbar__title {
    font-size: var(--fs-md);
  }

  .topbar__identity {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    justify-self: auto;
    gap: 8px;
    overflow: hidden;
  }

  .topbar__identity-motto {
    display: none;
  }

  .topbar__identity-copy {
    min-width: 0;
    overflow: hidden;
  }

  .topbar__identity-region {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar__identity-seal {
    width: 30px;
    height: 30px;
  }

  .topbar__end {
    flex: 0 0 auto;
    justify-self: auto;
  }

  .kanban {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-open .sidebar__brand-text,
  .app-shell.sidebar-open .sidebar__label,
  .app-shell.sidebar-open .sidebar__user-meta,
  .app-shell.sidebar-open .sidebar__logout span {
    display: block;
  }

  .app-shell.sidebar-open .sidebar__brand,
  .app-shell.sidebar-open .sidebar__link,
  .app-shell.sidebar-open .sidebar__logout {
    justify-content: flex-start;
  }

  .main-area,
  .app-shell.sidebar-collapsed .main-area,
  .app-shell:not(.sidebar-open) .main-area,
  .app-shell.sidebar-open .main-area {
    margin-left: 0 !important;
  }

  .app-shell.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 var(--space-2);
    grid-template-columns: unset;
  }

  .topbar__start {
    flex: 0 0 auto;
    max-width: none;
  }

  .topbar__breadcrumb,
  .topbar__title {
    display: none;
  }

  .topbar__identity {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    justify-self: auto;
    gap: 8px;
    overflow: hidden;
  }

  .topbar__identity-motto {
    display: none;
  }

  .topbar__identity-copy {
    min-width: 0;
    overflow: hidden;
  }

  .topbar__identity-region {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar__identity-seal {
    width: 28px;
    height: 28px;
  }

  .topbar__end {
    flex: 0 0 auto;
    justify-self: auto;
    gap: 4px;
  }

  .topbar__search {
    display: none;
  }

  .doc-filters {
    display: none;
  }

  .doc-filters-select {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
    order: -1;
  }

  .doc-toolbar .toolbar__filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .doc-toolbar .toolbar__search,
  .doc-toolbar .search-field.toolbar__search,
  .doc-toolbar .form-control {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .toolbar__filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .toolbar__search,
  .search-field.toolbar__search,
  .toolbar__filters .form-control {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .module-header > div:last-child {
    width: 100%;
  }

  .module-header .view-toggle {
    flex: 1 1 auto;
  }

  .module-header .btn {
    width: 100%;
  }

  .calendar__dow-full {
    display: none;
  }

  .calendar__dow-short {
    display: inline;
  }

  .calendar__dow {
    padding: 6px 2px;
    font-size: 11px;
  }

  .calendar__day {
    min-height: 52px;
    padding: 4px 2px;
  }

  .calendar__day-num {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .calendar__event {
    font-size: 8px;
    padding: 1px 2px;
    margin-bottom: 1px;
  }

  .calendar__month {
    font-size: var(--fs-sm);
    text-align: center;
  }

  .content {
    padding: var(--space-2);
  }

  .module-header {
    flex-direction: column;
  }

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

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kanban {
    grid-template-columns: 1fr;
  }

  .modal__footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    gap: 8px;
    padding: 12px var(--space-2);
  }

  .modal__footer > div {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
    justify-content: stretch !important;
    flex-wrap: nowrap !important;
  }

  .modal__footer > .btn,
  .modal__footer > div > .btn {
    width: 100%;
    min-width: 0;
    height: 38px;
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
  }

  .modal__footer > div > .btn:only-child {
    grid-column: 1 / -1;
  }

  .modal__footer > div:has(> .btn:nth-child(3)) > .btn--primary,
  .modal__footer > div:has(> .btn:nth-child(3)) > .btn--danger,
  .modal__footer > div:has(> .btn:nth-child(3)) > .btn--accent {
    grid-column: 1 / -1;
  }

  .modal__footer .profile-modal__footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
  }

  .modal__footer .profile-modal__btn {
    width: 100%;
    min-width: 0;
    height: 38px;
  }

  
  .table-wrap--responsive .table thead {
    display: none;
  }

  .table-wrap--responsive .table,
  .table-wrap--responsive .table tbody,
  .table-wrap--responsive .table tr,
  .table-wrap--responsive .table td {
    display: block;
    width: 100%;
  }

  .table-wrap--responsive .table tr {
    padding: var(--space-2);
    border-bottom: 1px solid var(--color-border);
  }

  .table-wrap--responsive .table td {
    padding: 4px 0;
    border: none;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .table-wrap--responsive .table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    flex-shrink: 0;
  }

  .table-wrap--responsive .table .table__actions {
    justify-content: flex-start;
  }

  .table-wrap--responsive .table .num {
    text-align: left;
  }

  .toast-container {
    left: var(--space-2);
    right: var(--space-2);
    bottom: var(--space-2);
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .login-split {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 280px;
    max-height: none;
  }

  .login-brand__content {
    gap: 32px;
    justify-content: flex-start;
    padding: var(--space-3);
  }

  .login-brand__bottom {
    margin-top: 8px;
    padding-top: 8px;
  }

  .login-brand__quote {
    font-size: var(--fs-lg);
  }

  .login-brand__sello {
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
  }

  .login-panel {
    min-height: auto;
    padding: var(--space-3);
    align-items: flex-start;
  }

  .login-panel__inner {
    max-width: none;
  }

  .login-panel__corner {
    width: 48px;
    height: 48px;
  }

  .login-panel__corner--tr {
    top: 16px;
    right: 16px;
  }

  .login-panel__corner--bl {
    bottom: 16px;
    left: 16px;
  }

  .login-panel__star--hero {
    opacity: 0.03;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar__identity-region {
    font-size: 13px;
  }

  .topbar__actions {
    gap: 0;
  }

  .topbar__icon-btn,
  .topbar__user {
    width: 36px;
    height: 36px;
  }

  .topbar__user {
    padding: 0;
    justify-content: center;
  }

  .login-brand__bottom {
    display: none;
  }

  .login-brand {
    min-height: 120px;
    max-height: none;
  }

  .login-brand__content {
    justify-content: center;
  }
}
