:root {
  --accent: #f6821f;
  --accent-dark: #c96812;
  --accent-soft: #fff4e8;
  --blue: #086fff;
  --ink: #111827;
  --text: #1f2937;
  --muted: #5f6368;
  --subtle: #7b8190;
  --line: #dfe3ea;
  --line-soft: #edf0f5;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --surface-hover: #f2f4f7;
  --rail: #fbfbfc;
  --red: #b42318;
  --green: #147a3f;
  --green-soft: #e8f5ec;
  --yellow-soft: #fff4cf;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 13px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 620;
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: none;
}

button:hover {
  background: var(--surface-hover);
  border-color: #c7ccd6;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.hidden {
  display: none !important;
}

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

.login-panel {
  width: min(386px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

.login-logo {
  width: 190px;
  max-width: 100%;
  display: block;
  margin-bottom: 18px;
}

.login-panel h1 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 25px;
  font-weight: 720;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.form-stack {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(246, 130, 31, 0.22);
  border-color: var(--accent);
}

.form-stack button,
#exportButton {
  background: var(--accent);
  border-color: var(--accent);
  color: #111827;
}

.form-stack button:hover,
#exportButton:hover {
  background: #f59b43;
}

.error-text {
  min-height: 18px;
  color: var(--red) !important;
  margin: 0;
}

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

.sidebar {
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px 20px;
}

.brand-block {
  min-height: 56px;
  display: flex;
  align-items: center;
}

.brand-logo {
  width: 174px;
  display: block;
}

.quick-search {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--subtle);
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.nav-item,
.ghost-button {
  width: 100%;
  min-height: 36px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-color: transparent;
  font-weight: 590;
  border-radius: 8px;
}

.nav-item:hover,
.ghost-button:hover {
  background: var(--surface-hover);
  border-color: transparent;
}

.nav-item.active {
  background: #eef1f5;
  color: #111827;
  border-color: transparent;
}

.ghost-button {
  margin-top: auto;
  border-color: var(--line);
  background: var(--surface);
}

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

.cloud-header {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 0 34px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.account-chip,
.domain-chip,
.header-links {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-chip {
  color: var(--ink);
  font-weight: 620;
}

.cloud-mark {
  width: 22px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
  position: relative;
}

.cloud-mark::before,
.cloud-mark::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 999px;
}

.cloud-mark::before {
  width: 14px;
  height: 14px;
  left: 2px;
  top: -6px;
}

.cloud-mark::after {
  width: 10px;
  height: 10px;
  right: 1px;
  top: -3px;
}

.domain-chip {
  color: var(--ink);
  font-weight: 650;
}

.domain-chip small {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface);
}

.header-links {
  color: var(--ink);
  font-weight: 620;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.live-lamp {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #9aa1ad;
  box-shadow: 0 0 0 3px rgba(154, 161, 173, 0.14);
}

.live-lamp.active {
  background: #16a34a;
  animation: pulseLamp 1.2s ease-in-out infinite;
}

@keyframes pulseLamp {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.05);
  }
}

.page-shell {
  padding: 34px;
  overflow: auto;
}

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

.topbar h1 {
  margin: 0;
  color: #0b1220;
  font-size: 29px;
  line-height: 1.15;
  font-weight: 760;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.recommendation-card {
  min-height: 90px;
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}

.recommendation-card strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
}

.recommendation-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.map-panel,
.panel-card {
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.map-panel {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.map-copy strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
}

.map-copy small {
  display: block;
  margin-top: 6px;
  line-height: 1.4;
}

.turkey-map {
  min-height: 170px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
}

.province {
  min-height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(246, 130, 31, 0.42);
  border-radius: 5px;
  color: #4b5563;
  font-size: 9px;
  line-height: 1;
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px;
}

.province.active {
  background: #ffb000;
  color: #111827;
  border-color: #f6821f;
  font-weight: 720;
}

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

.company-form button {
  background: var(--accent);
  border-color: var(--accent);
  color: #111827;
}

.hint-text {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.recommendation-card > span {
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stats-grid article,
.table-card,
.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.stats-grid article {
  padding: 14px 16px;
}

.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
}

.stats-grid strong {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
  font-weight: 680;
}

.filters {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 150px 150px;
  align-items: end;
  gap: 10px;
  padding: 12px;
  margin-bottom: 24px;
}

.table-card {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

.table-header small {
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
}

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

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

th {
  color: #3f4754;
  background: #fbfcfd;
  font-size: 12px;
  font-weight: 690;
  text-transform: none;
}

td {
  color: var(--ink);
  font-size: 13px;
}

tbody tr:hover {
  background: #fbfcfd;
}

.primary-cell {
  color: var(--ink);
  font-size: 13px;
  font-weight: 690;
}

.muted-cell,
small {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

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

.pill.yellow {
  background: var(--yellow-soft);
  color: #7a5100;
}

.pill.red {
  background: #ffe7e3;
  color: var(--red);
}

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

.row-actions button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--blue);
}

.secondary-button:hover {
  background: #f5f9ff;
  border-color: #bdd2ff;
}

.quiet-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.detail-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 720;
}

.detail-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
}

.detail-content {
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.detail-section h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
}

.field-grid {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 6px 10px;
  font-size: 12px;
}

.field-grid span:nth-child(odd) {
  color: var(--muted);
  font-weight: 650;
}

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

.photo-grid img,
.signature-img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.photo-grid img {
  aspect-ratio: 4 / 3;
}

.signature-img {
  max-height: 130px;
  object-fit: contain;
  background: var(--surface-soft);
}

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

  .sidebar {
    position: static;
  }

  .content {
    grid-template-rows: auto 1fr;
  }

  .cloud-header {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 14px 18px;
    gap: 10px;
  }

  .page-shell {
    padding: 22px 16px;
  }

  .stats-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}
