:root {
  --bg: #07090d;
  --panel: #10141b;
  --panel-strong: #151a22;
  --line: rgba(255, 255, 255, 0.1);
  --muted: #8c95a3;
  --text: #f7f8fb;
  --soft: #c8ced8;
  --orange: #ff8a00;
  --orange-strong: #ff5c00;
  --green: #31d083;
  --red: #ff5b5b;
  --blue: #58a6ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 138, 0, 0.15), transparent 28rem),
    linear-gradient(135deg, #050608 0%, #0d1118 52%, #080a0f 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.7fr);
  min-height: 100vh;
  padding: 32px;
  gap: 32px;
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  min-height: calc(100vh - 64px);
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.92)),
    url("assets/ztoo-logo.png") center 26% / min(88%, 920px) auto no-repeat,
    #030406;
  box-shadow: var(--shadow);
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 138, 0, 0.18), transparent 38%);
  pointer-events: none;
}

.login-logo {
  position: absolute;
  top: 24px;
  left: 24px;
  width: min(240px, 40vw);
  height: auto;
}

.brand-copy {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--orange);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.brand-copy h1 {
  margin-bottom: 18px;
  max-width: 780px;
  font-size: clamp(2.3rem, 5vw, 5rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.brand-copy p:last-child {
  max-width: 560px;
  color: var(--soft);
  font-size: 1.05rem;
  line-height: 1.7;
}

.login-card {
  align-self: center;
  display: grid;
  gap: 20px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card h2,
.topbar h2,
.dialog-head h2 {
  margin-bottom: 0;
  font-size: 1.75rem;
}

label {
  display: grid;
  gap: 8px;
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  color: var(--soft);
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  outline: none;
  padding: 12px 13px;
}

.currency-input {
  display: flex;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.currency-input:focus-within {
  border-color: rgba(255, 138, 0, 0.72);
  box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.12);
}

.currency-input span {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  border-right: 1px solid var(--line);
  padding: 0 12px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 800;
}

.currency-input input {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.currency-input input:focus {
  box-shadow: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 138, 0, 0.72);
  box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.12);
}

select option {
  background: #11151d;
}

.client-suggest-field {
  position: relative;
}

.client-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 8;
  display: grid;
  max-height: 230px;
  overflow: auto;
  border: 1px solid rgba(255, 138, 0, 0.28);
  border-radius: 8px;
  background: #11151d;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
}

.client-suggestion {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.client-suggestion:last-child {
  border-bottom: 0;
}

.client-suggestion:hover,
.client-suggestion.active {
  background: rgba(255, 138, 0, 0.14);
}

.client-suggestion strong,
.client-suggestion span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-suggestion strong {
  font-size: 0.9rem;
}

.client-suggestion span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn,
.icon-btn,
.row-btn,
.nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-btn {
  color: #111;
  background: linear-gradient(135deg, var(--orange), #ffd36a);
  padding: 0 18px;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(255, 116, 0, 0.24);
}

.secondary-btn,
.danger-btn,
.ghost-btn,
.row-btn,
.nav-item {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.secondary-btn {
  padding: 0 18px;
}

.danger-btn {
  border: 1px solid rgba(255, 91, 91, 0.42);
  color: #fff;
  background: linear-gradient(135deg, #ff5b5b, #b91c1c);
  padding: 0 18px;
  font-weight: 800;
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.ghost-btn:hover,
.row-btn:hover,
.nav-item:hover {
  transform: translateY(-1px);
}

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.dashboard-view {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.dashboard-view.sidebar-collapsed {
  grid-template-columns: 86px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  padding: 22px;
  background: rgba(5, 7, 10, 0.9);
  min-width: 0;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #030406;
  padding: 10px;
  min-height: 70px;
}

.sidebar-brand img {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
}

.sidebar-toggle {
  width: 38px;
  min-height: 38px;
  padding: 0;
}

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

.nav-item {
  justify-content: flex-start;
  width: 100%;
  padding: 0 14px;
  color: var(--soft);
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
}

.nav-item span,
.sidebar-logout span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item.active {
  border-color: rgba(255, 138, 0, 0.42);
  color: var(--text);
  background: rgba(255, 138, 0, 0.12);
}

.sidebar-logout {
  margin-top: auto;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.dashboard-view.sidebar-collapsed .sidebar {
  align-items: center;
  padding: 18px 12px;
}

.dashboard-view.sidebar-collapsed .sidebar-brand {
  display: flex;
  width: 100%;
  min-height: 48px;
  padding: 5px;
}

.dashboard-view.sidebar-collapsed .sidebar-brand img {
  display: none;
}

.dashboard-view.sidebar-collapsed .sidebar-toggle,
.dashboard-view.sidebar-collapsed .nav-item,
.dashboard-view.sidebar-collapsed .sidebar-logout {
  width: 46px;
  min-height: 46px;
  padding: 0;
  justify-content: center;
}

.dashboard-view.sidebar-collapsed .nav-item span,
.dashboard-view.sidebar-collapsed .sidebar-logout span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.dashboard-view.sidebar-collapsed .nav-list {
  width: 100%;
}

.main {
  padding: 28px;
  overflow: hidden;
}

.topbar,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.metrics article {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  padding: 18px;
}

.metrics span {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(1.15rem, 2.2vw, 1.9rem);
  line-height: 1.05;
}

.toolbar {
  margin-bottom: 14px;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box i,
.search-box > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.search-box input {
  height: 48px;
  padding-left: 46px;
}

.toolbar select {
  max-width: 180px;
}

.table-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.82);
  box-shadow: var(--shadow);
}

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

table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: var(--soft);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.invoice-id {
  color: var(--text);
  font-weight: 800;
}

.link-button {
  display: inline;
  width: auto;
  min-height: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  padding: 0;
  text-align: left;
  font-weight: 800;
}

.link-button:hover {
  color: var(--orange);
  text-decoration: underline;
  transform: none;
}

.client-cell {
  cursor: pointer;
}

.client-cell:hover .link-button {
  color: var(--orange);
  text-decoration: underline;
}

.client-cell:hover .description {
  color: var(--orange);
}

.description {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status.Paid {
  color: var(--green);
  background: rgba(49, 208, 131, 0.12);
}

.status.Pending {
  color: var(--blue);
  background: rgba(88, 166, 255, 0.12);
}

.status.Overdue {
  color: var(--red);
  background: rgba(255, 91, 91, 0.12);
}

.status.Draft {
  color: #d6d9df;
  background: rgba(214, 217, 223, 0.1);
}

.actions-col {
  width: 178px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.row-btn,
.icon-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
}

.row-btn.delete:hover {
  border-color: rgba(255, 91, 91, 0.5);
  color: var(--red);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 54px 18px;
  color: var(--muted);
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.overview-panel,
.clients-panel {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.insight-grid,
.client-summary {
  display: grid;
  grid-template-columns: 1.15fr repeat(3, minmax(170px, 1fr));
  gap: 14px;
}

.insight-card,
.dashboard-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
}

.insight-card {
  min-height: 132px;
  padding: 18px;
}

.hero-insight {
  background:
    radial-gradient(circle at 85% 18%, rgba(255, 138, 0, 0.22), transparent 9rem),
    linear-gradient(135deg, rgba(255, 138, 0, 0.16), rgba(255, 255, 255, 0.04));
}

.insight-card span,
.panel-head span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-card strong {
  display: block;
  margin: 16px 0 8px;
  overflow-wrap: anywhere;
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1.05;
}

.insight-card p {
  margin: 0;
  color: var(--soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-track div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange-strong), #ffd36a);
}

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

.settings-panel {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

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

.dashboard-panel {
  min-height: 280px;
  padding: 18px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.settings-preview {
  border: 1px solid rgba(255, 138, 0, 0.25);
  border-radius: 8px;
  background: rgba(255, 138, 0, 0.09);
  padding: 16px;
}

.settings-preview span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-preview strong {
  display: block;
  margin: 10px 0;
  color: var(--text);
  font-size: 1.6rem;
}

.settings-preview p,
.data-actions p {
  margin: 0;
  color: var(--soft);
  line-height: 1.6;
}

.data-actions {
  display: grid;
  gap: 14px;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.settings-saved {
  color: var(--green);
  font-weight: 800;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.status-breakdown,
.rank-list,
.mini-list {
  display: grid;
  gap: 12px;
}

.status-row {
  display: grid;
  gap: 9px;
}

.status-row > div:first-child,
.mini-row,
.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-row strong,
.mini-row span {
  color: var(--text);
}

.rank-row,
.mini-row {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.rank-row > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #111;
  background: linear-gradient(135deg, var(--orange), #ffd36a);
  font-weight: 900;
}

.rank-row div,
.mini-row div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.rank-row strong,
.mini-row strong {
  color: var(--text);
}

.rank-row small,
.mini-row small,
.mini-empty {
  color: var(--muted);
  line-height: 1.4;
}

.mini-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
}

.invoice-dialog,
.confirm-dialog {
  width: min(880px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #10141b;
  box-shadow: var(--shadow);
  padding: 0;
}

.client-detail-dialog {
  width: min(980px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
}

.client-detail-dialog > .dialog-head {
  align-items: center;
  margin-bottom: 10px;
}

.client-detail-dialog > .dialog-head h2 {
  font-size: 1.35rem;
}

.client-detail-dialog > .dialog-head .eyebrow {
  margin-bottom: 4px;
}

.client-detail-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 8px;
  margin: 6px 0 8px;
}

.client-detail-dialog .settings-card {
  padding: 8px 10px;
}

.client-detail-dialog .panel-head {
  display: none;
}

.client-detail-dialog .panel-head h3 {
  font-size: 0.9rem;
}

.client-detail-dialog .panel-head span {
  font-size: 0.66rem;
}

.detail-list,
.client-detail-metrics {
  display: grid;
  gap: 6px;
}

.detail-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.client-detail-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-list div,
.client-detail-metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  min-height: 38px;
  padding: 6px 8px;
}

.detail-list span,
.client-detail-metrics span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list strong,
.client-detail-metrics strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-invoice-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.client-invoice-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 12px;
}

.client-invoice-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.client-invoice-summary strong {
  display: block;
  color: var(--text);
  font-size: 1.15rem;
}

.client-invoice-shell {
  box-shadow: none;
}

.client-invoice-head {
  padding: 14px 16px 0;
  margin-bottom: 10px;
}

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
}

.invoice-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.invoice-dialog form {
  padding: 24px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.confirm-dialog h2 {
  margin-bottom: 10px;
}

.confirm-copy {
  margin-bottom: 22px;
  color: var(--soft);
  line-height: 1.6;
}

.icon-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.form-section {
  margin: 8px 0 -2px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--orange);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.form-section:first-child,
.form-section-row:first-child .form-section {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.form-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.form-section-row .form-section {
  margin: 0;
  border-top: 0;
  padding-top: 0;
}

.compact-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.line-items {
  display: grid;
  gap: 12px;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.32fr) 38px;
  gap: 12px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.line-item label {
  grid-template-rows: auto 1fr;
}

.line-item textarea {
  height: 72px;
  min-height: 72px;
}

.line-item .currency-input {
  height: 72px;
}

.line-item .currency-input input {
  height: 70px;
}

.line-item .row-btn {
  align-self: end;
}

.span-2 {
  grid-column: span 2;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  .login-view,
  .dashboard-view,
  .dashboard-view.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 56vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: 150px 42px 1fr auto;
    align-items: center;
    padding: 14px;
  }

  .dashboard-view.sidebar-collapsed .sidebar {
    align-items: center;
    padding: 14px;
  }

  .dashboard-view.sidebar-collapsed .sidebar-brand {
    display: grid;
    width: auto;
    min-height: auto;
    padding: 10px;
  }

  .dashboard-view.sidebar-collapsed .sidebar-brand img {
    display: block;
  }

  .dashboard-view.sidebar-collapsed .nav-item span,
  .dashboard-view.sidebar-collapsed .sidebar-logout span {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: hidden;
    clip: auto;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .sidebar-logout {
    margin-top: 0;
  }

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

  .insight-grid,
  .client-summary,
  .client-detail-grid,
  .client-invoice-summary,
  .overview-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-view,
  .main {
    padding: 16px;
  }

  .brand-panel {
    min-height: 430px;
    padding: 22px;
  }

  .login-logo {
    width: 180px;
  }

  .brand-copy h1 {
    font-size: 2.25rem;
  }

  .topbar,
  .toolbar,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar select {
    max-width: none;
  }

  .metrics,
  .form-grid,
  .settings-form {
    grid-template-columns: 1fr;
  }

  .form-section-row,
  .line-item {
    grid-template-columns: 1fr;
  }

  .form-section-row {
    align-items: stretch;
    flex-direction: column;
  }

  .span-2 {
    grid-column: span 1;
  }

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

  .sidebar-brand {
    max-width: 180px;
  }

  .sidebar-toggle {
    display: none;
  }
}
