:root {
  color-scheme: light;
  --blue: #174ea6;
  --blue-dark: #103b7d;
  --blue-soft: #eaf2ff;
  --ink: #162033;
  --muted: #657086;
  --line: #dce3ed;
  --surface: #ffffff;
  --background: #f4f7fb;
  --green: #087a55;
  --red: #b42318;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--background); color: var(--ink); }
body { min-height: 100dvh; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(320px, 520px);
  justify-content: center;
  align-items: center;
  gap: 64px;
  padding: 32px;
  background: linear-gradient(120deg, var(--blue-dark) 0 42%, var(--background) 42% 100%);
}
.login-brand { color: white; }
.login-brand img { display: block; margin-bottom: 20px; box-shadow: 0 12px 28px rgba(4, 28, 70, .25); border-radius: 8px; }
.login-brand h1 { margin: 0; font-size: 42px; line-height: 1.05; letter-spacing: 0; }
.login-brand p { margin: 10px 0 0; color: #dbe9ff; font-size: 18px; }
.login-form { background: var(--surface); border: 1px solid var(--line); padding: 28px; box-shadow: 0 18px 42px rgba(30, 58, 96, .13); border-radius: 8px; }
label { display: block; margin-bottom: 6px; color: #3d485b; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 46px; border: 1px solid #c8d1df; border-radius: 6px; background: white; color: var(--ink); padding: 10px 12px; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 78, 166, .12); }
.login-form input { margin-bottom: 16px; }

.button { min-height: 42px; border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 700; }
.button.primary { background: var(--blue); color: white; }
.button.primary:hover { background: var(--blue-dark); }
.button.danger { background: var(--red); color: white; }
.button.wide { width: 100%; margin-top: 4px; }
.button.compact { min-height: 36px; padding: 7px 12px; }
.button:disabled { opacity: .6; cursor: wait; }
.text-button { border: 0; background: transparent; color: var(--blue); font-weight: 700; padding: 6px 0; }
.icon-button { width: 40px; height: 40px; border: 0; background: transparent; color: white; font-size: 28px; line-height: 1; }

.app-header { position: sticky; top: 0; z-index: 20; background: var(--blue); color: white; box-shadow: 0 2px 10px rgba(20, 53, 96, .2); padding-top: env(safe-area-inset-top); }
.header-inner { min-height: 64px; max-width: 1040px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 12px; }
.header-title { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.header-title img { border-radius: 5px; }
.header-title strong, .header-title span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.header-title strong { font-size: 18px; }
.header-title span { color: #dbe9ff; font-size: 12px; margin-top: 2px; }
.main-content { max-width: 1040px; margin: 0 auto; padding: 24px 20px calc(34px + env(safe-area-inset-bottom)); }

.identity-row { display: grid; grid-template-columns: 1fr minmax(280px, 460px); gap: 24px; align-items: end; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.identity-row span, .identity-row strong { display: block; }
.identity-row span { color: var(--muted); font-size: 13px; }
.identity-row strong { margin-top: 5px; font-size: 20px; }
.database-field label { margin-bottom: 5px; }

.section-block { padding: 24px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.pazar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 16px; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 7px 0 4px; font-size: 24px; color: var(--green); }
.metric small { font-size: 12px; }

.action-list { margin-top: 18px; border-top: 1px solid var(--line); }
.action-row { width: 100%; min-height: 76px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); padding: 14px 4px; display: flex; align-items: center; justify-content: space-between; text-align: left; }
.action-row:hover { background: #edf3fb; }
.action-row strong, .action-row small { display: block; }
.action-row strong { font-size: 16px; }
.action-row small { margin-top: 5px; color: var(--muted); font-size: 13px; }
.action-row b { color: var(--blue); font-size: 28px; font-weight: 400; }

.segment-control { display: grid; grid-template-columns: 1fr 1fr; width: min(460px, 100%); margin-bottom: 18px; border: 1px solid var(--blue); border-radius: 6px; overflow: hidden; }
.segment-control button { min-height: 42px; border: 0; background: white; color: var(--blue); font-weight: 700; }
.segment-control button.active { background: var(--blue); color: white; }
.search-field { margin-bottom: 16px; }
.partner-list, .transaction-list { border-top: 1px solid var(--line); }
.partner-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 15px 4px; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(120px, auto) 22px; gap: 12px; align-items: center; color: var(--ink); text-align: left; }
.partner-row:hover { background: #edf3fb; }
.partner-name strong, .partner-name small { display: block; }
.partner-name small { margin-top: 4px; color: var(--muted); }
.money-cell { text-align: right; }
.money-cell span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.money-cell strong { font-size: 14px; }
.saldo-value { color: var(--green); }
.saldo-value.negative { color: var(--red); }
.chevron { color: var(--blue); font-size: 22px; }

.filters { display: grid; grid-template-columns: minmax(220px, 1fr) 170px 170px auto; gap: 12px; align-items: end; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.filters .button { min-width: 110px; }
.summary-grid { display: grid; grid-template-columns: minmax(180px, 320px); gap: 10px; margin: 18px 0; justify-content: end; }
.summary-item { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 13px; text-align: center; }
.summary-item span { display: block; color: var(--muted); font-size: 12px; }
.summary-item strong { display: block; margin-top: 5px; font-size: 17px; }
.transaction-row { display: grid; grid-template-columns: 110px minmax(180px, 1fr) 150px; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); align-items: start; }
.transaction-row strong, .transaction-row span, .transaction-row small { display: block; }
.transaction-row small { color: var(--muted); margin-top: 4px; line-height: 1.4; }
.transaction-row .amount { text-align: right; }

.message { margin: 14px 0; padding: 12px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: var(--blue-dark); }
.message.error { border-left-color: var(--red); background: #fff0ef; color: #8f2018; }
.loading, .empty { color: var(--muted); padding: 24px 4px; }
.about { max-width: 720px; }
.about img { border-radius: 7px; }
.about h2 { margin: 16px 0 20px; }
.about p { color: #3d485b; line-height: 1.7; }

@media (max-width: 720px) {
  .login-screen { display: flex; flex-direction: column; justify-content: center; gap: 26px; padding: 28px 18px; background: var(--background); }
  .login-brand { width: 100%; max-width: 430px; color: var(--ink); }
  .login-brand img { width: 64px; height: 64px; margin-bottom: 14px; }
  .login-brand h1 { font-size: 32px; }
  .login-brand p { color: var(--muted); font-size: 15px; }
  .login-form { width: 100%; max-width: 430px; padding: 20px; }
  .header-inner { padding: 9px 14px; }
  .main-content { padding: 18px 14px calc(28px + env(safe-area-inset-bottom)); }
  .identity-row { grid-template-columns: 1fr; gap: 14px; }
  .pazar-grid { grid-template-columns: 1fr; }
  .partner-row { grid-template-columns: minmax(0, 1fr) 112px 18px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .full, .filters .button { grid-column: 1 / -1; }
  .summary-grid { grid-template-columns: 1fr; gap: 6px; }
  .summary-item { padding: 10px 4px; }
  .summary-item strong { font-size: 14px; overflow-wrap: anywhere; }
  .transaction-row { grid-template-columns: 82px 1fr; gap: 8px 12px; }
  .transaction-row .amount { text-align: left; }
  .button.compact { font-size: 13px; }
}
