:root {
  --navy: #0B2F4E;
  --sky: #4C97B0;
  --deep-sky: #2C6E8F;
  --sprout: #5FA845;
  --ink: #243B4A;
  --slate: #6B7C88;
  --paper: #F7F9FA;
  --card: #FFFFFF;
  --mist: #E4EAED;
  --rain: #3E7CB1;
  --shadow: 0 1px 2px rgba(11, 47, 78, .04), 0 8px 24px rgba(11, 47, 78, .06);
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: Poppins, "Segoe UI", sans-serif; font-weight: 400; color: var(--navy); letter-spacing: .2px; }

a { color: var(--deep-sky); }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--mist);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand .word { font-family: Poppins, sans-serif; font-weight: 400; font-size: 22px; color: var(--navy); letter-spacing: .3px; }
a.brand { cursor: pointer; }
a.brand:hover .word { color: var(--deep-sky); }

.header-actions { display: flex; gap: 8px; }
.btn-ghost {
  font: inherit; font-size: 14px; color: var(--slate);
  background: none; border: 1px solid var(--mist); border-radius: 9px;
  padding: 7px 14px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn-ghost:hover { color: var(--navy); border-color: var(--slate); }
.btn-ghost:disabled { opacity: .55; cursor: default; }
.btn-ghost.active { color: var(--navy); border-color: var(--deep-sky); background: #EEF4F6; }

main { padding: 28px 0 60px; }

.lede { color: var(--slate); font-size: 14.5px; margin: 4px 0 22px; }
.lede strong { color: var(--ink); font-weight: 500; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 1px solid var(--mist); }
.tab {
  font: inherit; font-size: 15px; background: none; border: none; cursor: pointer;
  padding: 12px 16px; color: var(--slate); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: .15s;
}
.tab .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.tab[data-src="mgm"] .dot { background: var(--deep-sky); }
.tab[data-src="openmeteo"] .dot { background: var(--sprout); }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--navy); }
.tab[data-src="mgm"].active { border-bottom-color: var(--deep-sky); }
.tab[data-src="openmeteo"].active { border-bottom-color: var(--sprout); }

/* ---------- controls ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--slate); font-weight: 500; }
.field select {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--card);
  border: 1px solid var(--mist); border-radius: 10px; padding: 9px 12px; min-width: 190px;
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7C88' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px;
}
.field select:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.updated { margin-left: auto; font-size: 13px; color: var(--slate); align-self: center; }
.updated b { color: var(--ink); font-weight: 500; }

/* ---------- cards / grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--mist); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 14px;
}
.card.span-2 { grid-column: 1 / -1; }
.card h3 { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.card .sub { font-size: 12.5px; color: var(--slate); margin-bottom: 12px; }
.chart-box { position: relative; height: 260px; }
.card.span-2 .chart-box { height: 300px; }

/* ---------- table ---------- */
.table-scroll { overflow-x: auto; border-radius: 10px; border: 1px solid var(--mist); }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--mist); }
th { background: var(--paper); color: var(--slate); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; font-size: 11px; position: sticky; top: 0; }
td:first-child, th:first-child, td.txt, th.txt { text-align: left; }
tbody tr:last-child td { border-bottom: none; }
tr:hover td { background: #FBFCFD; }

/* ---------- states ---------- */
.state { padding: 40px 20px; text-align: center; color: var(--slate); font-size: 14px; }
.spinner {
  width: 22px; height: 22px; border: 2px solid var(--mist); border-top-color: var(--deep-sky);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer { color: var(--slate); font-size: 12.5px; padding: 24px 0 40px; text-align: center; }
footer .wrap { border-top: 1px solid var(--mist); padding-top: 20px; }

/* ---------- login ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(76,151,176,.14), transparent 60%),
    var(--paper);
}
.login-card {
  background: var(--card); border: 1px solid var(--mist); border-radius: 18px;
  box-shadow: var(--shadow); padding: 36px 32px; width: 100%; max-width: 380px; text-align: center;
}
.login-card img { height: 40px; margin-bottom: 18px; }
.login-card h1 { font-size: 20px; margin-bottom: 6px; }
.login-card p { color: var(--slate); font-size: 13.5px; margin-bottom: 24px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-card input {
  font: inherit; font-size: 15px; width: 100%; padding: 11px 13px;
  border: 1px solid var(--mist); border-radius: 10px; background: var(--paper); color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.login-card button {
  font: inherit; font-size: 15px; font-weight: 500; width: 100%; margin-top: 6px;
  padding: 12px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--deep-sky); color: #fff; transition: .15s;
}
.login-card button:hover { background: var(--navy); }
.login-card button:disabled { opacity: .6; cursor: default; }
.login-err { color: #C0392B; font-size: 13px; margin-top: 14px; min-height: 18px; }

/* ---------- şehir yönetimi ---------- */
body.view-admin .tabs,
body.view-admin .controls { display: none; }

.admin { max-width: 720px; }
.admin .back {
  display: inline-block; font-size: 13.5px; color: var(--slate);
  cursor: pointer; margin-bottom: 14px;
}
.admin .back:hover { color: var(--navy); }
.admin h2 { font-size: 20px; margin-bottom: 6px; }
.admin > .sub { color: var(--slate); font-size: 13.5px; margin-bottom: 20px; line-height: 1.6; }
.admin .card { margin-bottom: 18px; }
.admin .card h3 { font-size: 15px; font-weight: 500; margin-bottom: 12px; }

.notice { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.notice.warn { background: #FDF6E3; color: #8A6D3B; border: 1px solid #F0E3C0; }

.add-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.add-form .field { flex: 1 1 150px; }
.add-form input, .add-form select {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--mist); border-radius: 10px; padding: 9px 12px; width: 100%;
}
.add-form input:focus, .add-form select:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.add-form button {
  font: inherit; font-size: 14.5px; font-weight: 500; color: #fff; background: var(--deep-sky);
  border: none; border-radius: 10px; padding: 10px 20px; cursor: pointer; transition: .15s;
}
.add-form button:hover { background: var(--navy); }
.add-form button:disabled { opacity: .6; cursor: default; }

.add-status { font-size: 13px; margin-top: 12px; min-height: 18px; color: var(--slate); }
.add-status.ok { color: #2E6B22; }
.add-status.err { color: #C0392B; }

.link-danger {
  font: inherit; font-size: 12.5px; color: #C0392B; background: none; border: none;
  cursor: pointer; padding: 2px 4px;
}
.link-danger:hover { text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 780px) {
  .grid { grid-template-columns: 1fr; }
  .updated { margin-left: 0; width: 100%; }
  .field select { min-width: 0; width: 100%; }
  .field { flex: 1 1 100%; }
  .brand .word { display: none; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}
