:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #17212f;
  --muted: #637083;
  --line: #d9e0e8;
  --primary: #2364aa;
  --primary-strong: #174d86;
  --good: #247a5b;
  --warn: #ad6b16;
  --danger: #bb3e3e;
  --shadow: 0 16px 42px rgba(40, 54, 74, 0.12);
}

* {
  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", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app {
  min-height: 100vh;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 38px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand h1,
.login-brand h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.05;
}

.brand p,
.login-brand p {
  margin: 6px 0 0;
  color: var(--muted);
}

.top-actions,
.tabs,
.row,
.module-actions,
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.tabs {
  margin-bottom: 18px;
}

.btn,
.tab,
.quiet-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 750;
  transition: background 160ms ease, transform 160ms ease;
}

.btn:hover,
.tab:hover,
.quiet-button:hover {
  transform: translateY(-1px);
  background: var(--primary-strong);
}

.btn.secondary,
.tab,
.quiet-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.tab.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.btn.good {
  background: var(--good);
}

.btn.warn {
  background: var(--warn);
}

.btn.danger {
  background: var(--danger);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
}

.login-card,
.panel,
.module-board,
.user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card,
.panel {
  padding: 20px;
}

.login-brand {
  margin-bottom: 16px;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(35, 100, 170, 0.15);
}

.error {
  color: var(--danger);
  min-height: 1.25em;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.module-card {
  min-height: 190px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.module-card h2,
.panel h2,
.module-board h2,
.user-card h3 {
  margin: 0;
  font-size: 1.08rem;
}

.module-card p,
.panel p,
.module-board p {
  color: var(--muted);
  line-height: 1.5;
}

.module-board {
  padding: 18px;
}

.module-layout {
  display: grid;
  gap: 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.stat strong {
  display: block;
  font-size: 1.5rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.84rem;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 520px;
}

.memory-card {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 2rem;
  font-weight: 850;
}

.memory-card.open,
.memory-card.matched {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.reaction-stage {
  min-height: 260px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: center;
  padding: 22px;
}

.reaction-stage.waiting {
  background: #f2e7d6;
}

.reaction-stage.ready {
  background: #dff1e8;
}

.reaction-stage.too-soon {
  background: #f2dede;
}

.reaction-stage strong {
  display: block;
  font-size: 2rem;
}

.scramble-word {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  min-width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 18px;
  background: var(--surface-2);
  font-size: 2rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.masraf-module {
  display: grid;
  gap: 16px;
}

.uyap-module {
  display: grid;
  gap: 14px;
}

.vpn-module {
  display: grid;
  gap: 14px;
}

.masraf-header,
.uyap-header,
.vpn-header,
.project-tabs,
.project-strip,
.entry-card,
.summary-card,
.ledger-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.masraf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.uyap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.vpn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.uyap-header h2 {
  margin: 0;
}

.vpn-header h2 {
  margin: 0;
}

.uyap-header p:last-child {
  margin-bottom: 0;
}

.vpn-header p:last-child {
  margin-bottom: 0;
}

.uyap-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 14px;
  align-items: stretch;
}

.vpn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 14px;
  align-items: stretch;
}

.vpn-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.vpn-actions .quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.vpn-detail-list {
  display: grid;
  gap: 8px;
}

.vpn-detail-list div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.vpn-detail-list span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.vpn-detail-list strong {
  overflow-wrap: anywhere;
}

.vpn-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.vpn-steps article {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
}

.vpn-steps span {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-weight: 850;
}

.vpn-steps strong {
  display: block;
}

.vpn-steps p {
  margin: 5px 0 0;
}

.vpn-usage-table {
  min-width: 920px;
}

.vpn-devices-table {
  min-width: 880px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.sync-badge.synced {
  border-color: rgba(36, 122, 91, 0.3);
  background: #dff1e8;
  color: var(--good);
}

.sync-badge.pending,
.sync-badge.needs_google,
.sync-badge.ready_for_google {
  border-color: rgba(173, 107, 22, 0.28);
  background: #f2e7d6;
  color: var(--warn);
}

.sync-badge.ignored {
  color: var(--muted);
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid color-mix(in srgb, var(--source-color) 32%, transparent);
  border-radius: 999px;
  padding: 4px 10px;
  background: color-mix(in srgb, var(--source-color) 12%, white);
  color: var(--source-color);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.source-badge::before,
.source-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--source-color);
  content: "";
  display: inline-block;
}

.source-badge.avukat,
.source-dot.avukat {
  --source-color: #2563EB;
}

.source-badge.taraf,
.source-dot.taraf {
  --source-color: #16A34A;
}

.uyap-table {
  min-width: 1260px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-pill {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
  text-align: center;
}

.project-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
}

.project-tab {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 16px;
  background: transparent;
  color: var(--text);
}

.project-tab span {
  font-weight: 850;
}

.project-tab small {
  color: var(--muted);
  font-weight: 750;
}

.project-tab.active {
  background: var(--primary);
  color: #fff;
}

.project-tab.active small {
  color: rgba(255, 255, 255, 0.82);
}

.project-strip {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.project-strip h2,
.masraf-header h2 {
  margin: 0;
}

.project-strip p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.masraf-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.entry-card,
.summary-card,
.ledger-card {
  padding: 18px;
}

.card-heading,
.ledger-heading,
.subsection-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-heading {
  margin-bottom: 18px;
}

.card-heading small,
.subsection-title span {
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 82px;
  padding: 11px 12px;
  resize: vertical;
}

select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(35, 100, 170, 0.15);
}

.subsection {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-2);
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.amount-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.attachment-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: var(--surface);
}

.attachment-item strong,
.attachment-item span {
  display: block;
  overflow-wrap: anywhere;
}

.attachment-item span,
.muted-line,
.muted {
  color: var(--muted);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--text);
}

.form-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.form-actions {
  margin-top: 18px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary-strong);
  font-weight: 800;
}

.text-button.danger {
  color: var(--danger);
}

.partner-cards {
  display: grid;
  gap: 10px;
}

.partner-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.partner-card span,
.partner-card small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.partner-card strong {
  display: block;
  margin: 7px 0 4px;
  font-size: 1.18rem;
}

.category-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.category-box summary {
  padding: 14px;
  cursor: pointer;
  font-weight: 850;
}

.category-summary {
  display: grid;
  padding: 0 14px 14px;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 11px 0;
}

.category-row span,
.category-row small {
  color: var(--muted);
  font-weight: 750;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 11px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.description-cell strong,
.description-cell small,
.money-cell small,
.rate-cell small {
  display: block;
}

.description-cell small,
.money-cell small,
.rate-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.money-cell {
  white-space: nowrap;
}

.document-list {
  display: grid;
  gap: 6px;
}

.document-button {
  color: var(--primary-strong);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 16px 0 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 14px;
  align-items: start;
}

.users-list {
  display: grid;
  gap: 12px;
}

.activity-panel {
  margin-top: 14px;
}

.module-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.setting-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-2);
}

.setting-card span,
.setting-card strong {
  display: block;
}

.setting-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.setting-card strong {
  margin-top: 6px;
  font-size: 1.35rem;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(187, 62, 62, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: #f2dede;
}

.danger-zone p {
  margin: 5px 0 0;
  color: var(--muted);
}

.activity-heading,
.activity-item {
  display: grid;
  gap: 10px;
}

.activity-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.activity-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.activity-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.activity-item {
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.activity-item strong,
.activity-item span,
.activity-item time,
.activity-item small {
  display: block;
}

.activity-item span,
.activity-item time,
.activity-item small,
.activity-item p {
  color: var(--muted);
}

.activity-item time,
.activity-item small {
  text-align: right;
}

.activity-item p {
  grid-column: 1 / -1;
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.user-card {
  padding: 14px;
}

.user-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--text);
}

.check input {
  width: 18px;
  min-height: 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  transform: translateY(140%);
  transition: transform 180ms ease;
  border-radius: 8px;
  padding: 13px 15px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
}

.toast.show {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .dashboard-grid,
  .admin-grid,
  .masraf-workspace,
  .uyap-grid,
  .vpn-grid,
  .vpn-steps {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-heading,
  .activity-item {
    grid-template-columns: 1fr;
  }

  .activity-item time,
  .activity-item small {
    text-align: left;
  }
}

@media (max-width: 580px) {
  .shell {
    width: min(100% - 22px, 1220px);
    padding-top: 16px;
  }

  .dashboard-grid,
  .stats,
  .checks,
  .project-tabs,
  .form-grid,
  .amount-grid,
  .module-settings,
  .vpn-actions {
    grid-template-columns: 1fr;
  }

  .masraf-header,
  .uyap-header,
  .vpn-header,
  .project-strip,
  .card-heading,
  .ledger-heading,
  .subsection-title,
  .danger-zone {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-strip p:last-child {
    text-align: left;
  }

  .memory-grid {
    gap: 7px;
  }
}
