:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d7dee8;
  --text: #172033;
  --muted: #637083;
  --accent: #d43f2a;
  --accent-strong: #ab2f20;
  --teal: #087e8b;
  --green: #16835b;
  --amber: #b7791f;
  --blue: #2b64c8;
  --shadow: 0 10px 24px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

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

button {
  border: 0;
}

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

.sidebar,
.inspector {
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-width: 0;
}

.inspector {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 40px;
  height: 40px;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.sidebar-tools,
.inspector-inner {
  padding: 14px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 11px;
  min-height: 40px;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: 3px solid rgba(8, 126, 139, 0.16);
  border-color: var(--teal);
}

.icon-button,
.primary-button,
.quiet-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.icon-button {
  width: 40px;
  padding: 0;
  color: #fff;
  background: var(--teal);
}

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

.danger-button {
  color: #fff;
  background: var(--accent-strong);
}

.quiet-button {
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.icon-button:hover,
.primary-button:hover,
.quiet-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.customer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 16px;
}

.customer-row {
  width: 100%;
  text-align: left;
  background: transparent;
  border-radius: 8px;
  padding: 11px 10px;
  cursor: pointer;
  color: var(--text);
}

.customer-row:hover,
.customer-row.active {
  background: #eef6f7;
}

.row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
}

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

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 18px 22px 0;
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.page-meta {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

.status-chip,
.count-chip,
.mode-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  min-height: 24px;
  padding: 2px 8px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.mode-chip {
  background: #fff6df;
  color: #7a4a00;
  border: 1px solid #f2d58a;
}

.mode-chip.online {
  background: #e8f7ef;
  color: #0f6846;
  border-color: #a7dec3;
}

.count-chip {
  background: #e8eefb;
  color: var(--blue);
}

.status-chip.open {
  background: #fff6df;
  color: var(--amber);
}

.status-chip.completed,
.status-chip.resolved,
.status-chip.in-service {
  background: #e8f7ef;
  color: var(--green);
}

.status-chip.urgent,
.status-chip.failed {
  background: #fdeceb;
  color: var(--accent-strong);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  padding: 12px 10px 10px;
  cursor: pointer;
  font-weight: 800;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.content {
  padding: 18px 22px 28px;
  overflow: auto;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.metric-value {
  font-size: 23px;
  font-weight: 850;
}

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

.section-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

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

.section-title {
  font-size: 14px;
  font-weight: 850;
}

.data-list {
  display: flex;
  flex-direction: column;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

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

.data-main {
  min-width: 0;
}

.data-title {
  font-weight: 850;
}

.data-subtitle,
.data-notes {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.inspector-title {
  margin: 0 0 10px;
  font-size: 17px;
}

.inspector-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 14px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.empty {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 5;
  background: #172033;
  color: #fff;
  border-radius: 8px;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.hidden {
  display: none;
}

.home-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 18px;
  margin-bottom: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.home-band h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.home-band p {
  color: var(--muted);
  margin: 7px 0 0;
  line-height: 1.45;
}

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

.quick-link {
  position: relative;
  min-width: 0;
}

.quick-link-main {
  width: 100%;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 12px 38px 12px 12px;
  cursor: pointer;
}

.quick-link-main:hover {
  background: #eef6f7;
  border-color: #b9dce0;
}

.quick-link-main span {
  font-size: 14px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.quick-link-main small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quick-link-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fdeceb;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 900;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef3f7;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-brand img {
  width: 44px;
  height: 44px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.auth-brand div div {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-tab {
  min-height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(23, 32, 51, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 10px 0;
}

.wide {
  width: 100%;
  margin-top: 8px;
}

.compact {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.account-name {
  font-size: 13px;
  font-weight: 850;
}

.account-role {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.static-input {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  border-radius: 8px;
  padding: 10px 11px;
  font-weight: 800;
}

.permission-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.check-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

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

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topline,
  .data-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .summary-grid,
  .field-grid,
  .quick-link-grid {
    grid-template-columns: 1fr;
  }

  .home-band {
    grid-template-columns: 1fr;
  }

  .content,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

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