/**
 * Santiye_Yonetim — ortak pastel tema (açık gri, açık mavi, açık pembe, beyaz)
 */
:root {
  --bg-page: #eef1f5;
  --bg-soft: #e8edf3;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --surface-blue: #e8f0fa;
  --surface-pink: #fdf2f7;
  --border: #dde4ee;
  --border-soft: #e8ecf2;
  --text: #3d4a5c;
  --text-muted: #6b7a90;
  --accent-blue: #8eb4dc;
  --accent-blue-deep: #5a8fc4;
  --accent-pink: #e8b8cc;
  --accent-pink-deep: #c97b9a;
  --success: #7eb88c;
  --danger: #d98a8a;
  --shadow: 0 2px 14px rgba(80, 100, 130, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.45;
}

/* Üst durum çubuğu (auth.php) */
.app-statusbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 20px;
  background: linear-gradient(90deg, var(--surface-blue) 0%, var(--surface-pink) 100%);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.app-statusbar__user { text-align: right; line-height: 1.25; }
.app-statusbar__user b { color: var(--text); }
.app-statusbar__role { font-size: 11px; color: var(--text-muted); }
.app-statusbar__logout {
  color: var(--accent-pink-deep);
  text-decoration: none;
  font-weight: 700;
  font-size: 11px;
  padding: 6px 12px;
  border: 1px solid var(--accent-pink);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.app-statusbar__logout:hover { background: var(--surface-pink); }

.app-statusbar__theme {
  display: inline-flex;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
.app-statusbar__theme-btn {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.app-statusbar__theme-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}
.app-statusbar__theme-btn.is-active {
  background: linear-gradient(180deg, var(--surface-blue) 0%, var(--surface-pink) 100%);
  color: var(--accent-blue-deep);
}
html[data-theme="dark"] .app-statusbar__theme-btn.is-active {
  background: linear-gradient(180deg, #3d4d66 0%, #4a3d52 100%);
  color: #f1f5f9;
}

/* Giriş kutusu */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--surface-blue) 0%, var(--bg-page) 45%, var(--surface-pink) 100%);
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  padding: 36px 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
}
.login-box h2 { margin: 0 0 20px; font-size: 1.35rem; color: var(--text); font-weight: 700; }

/* Genel düzen */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 20px; }

.shell {
  display: flex;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  min-height: calc(100vh - 52px);
  padding: 16px 20px;
  gap: 18px;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 440px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
}
.sidebar-brand {
  padding: 18px 16px;
  background: linear-gradient(135deg, var(--surface-blue) 0%, var(--surface) 55%, var(--surface-pink) 100%);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.sidebar-brand strong { display: block; font-size: 15px; line-height: 1.35; }
.sidebar-brand small {
  opacity: 0.85;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-nav.side-nav--split {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}
.side-nav.side-nav--split .side-nav__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-nav.side-nav--split .side-nav__col:first-child {
  border-right: 1px solid var(--border-soft);
  padding-right: 8px;
  margin-right: 2px;
}
.side-nav a {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  margin: 0;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  min-width: 0;
}
.side-nav a:hover {
  background: var(--surface-2);
  border-left-color: var(--accent-blue-deep);
}
.side-nav a i {
  margin-top: 2px;
  width: 20px;
  text-align: center;
  color: var(--accent-blue-deep);
  flex-shrink: 0;
}
.side-nav a i.fab { color: #6bbd8a; }
.side-nav a .t {
  font-weight: 600;
  font-size: 12px;
  line-height: 1.25;
  display: block;
  word-break: break-word;
}
.side-nav a .s {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
  display: block;
  line-height: 1.25;
  word-break: break-word;
}

.main { flex: 1; min-width: 0; }
.panel-card, .box, .page-header {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 1px solid var(--border-soft);
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

h1, h2, h3 { color: var(--text); }
h1 { font-size: 1.35rem; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }

/* Tablolar */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); text-align: left; }
th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Form */
label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text); font-size: 14px; }
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-blue-deep);
  box-shadow: 0 0 0 3px rgba(142, 180, 220, 0.35);
}
.form-group { margin-bottom: 14px; }

/* Butonlar */
.btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s, box-shadow 0.12s;
  color: var(--text);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.btn-blue {
  background: linear-gradient(180deg, #a8c8e8 0%, var(--accent-blue-deep) 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
}
.btn-green {
  background: linear-gradient(180deg, #b8dcc4 0%, var(--success) 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
}
.btn-red {
  background: linear-gradient(180deg, #e8c0c0 0%, var(--danger) 100%);
  color: #fff;
}
.btn-gray {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-dark {
  background: linear-gradient(180deg, #c5ccd6 0%, #7a8799 100%);
  color: #fff;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(200, 210, 225, 0.55);
  overflow-y: auto;
  backdrop-filter: blur(3px);
}
.modal-content {
  background: var(--surface);
  padding: 24px;
  max-width: 1000px;
  width: 92%;
  margin: 28px auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Yardımcı */
.text-right { text-align: right !important; }
.text-right-bold { text-align: right !important; font-family: ui-monospace, monospace; font-size: 15px; min-width: 100px; display: inline-block; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.stat-badge {
  background: var(--surface-blue);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.stat-badge i { color: var(--accent-blue-deep); font-size: 13px; opacity: 0.9; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; }

.dashboard-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.dashboard-head__main { min-width: 0; flex: 1; }
.dashboard-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.dashboard-recent-card {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dashboard-recent-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.dashboard-recent-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.35;
  max-width: 36rem;
}
.dashboard-recent-head .btn-compact {
  align-self: center;
  flex-shrink: 0;
}
.dashboard-recent-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.btn-compact {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.dashboard-recent-empty {
  margin: 0;
  padding: 20px 20px 22px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.dashboard-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dashboard-recent-item {
  border-bottom: 1px solid var(--border-soft);
}
.dashboard-recent-item:last-child { border-bottom: none; }
.dashboard-recent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.dashboard-recent-row:hover {
  background: var(--surface-2);
}
.dashboard-recent-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dashboard-recent-item-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}
.dashboard-recent-item-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.dashboard-todo-badge {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.dashboard-todo-badge.is-pending {
  background: #fff3e0;
  color: #c65f00;
  border: 1px solid #ffd8a8;
}
.dashboard-todo-badge.is-done {
  background: #e6f4ea;
  color: #1e6f3e;
  border: 1px solid #b8dcc4;
}
.dashboard-todo-badge.is-progress {
  background: #e8f0fa;
  color: #1a5fb4;
  border: 1px solid #c8ddf5;
}

.dashboard-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  min-width: 0;
}
.dashboard-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dashboard-card h3 i { color: var(--accent-blue-deep); opacity: 0.9; }
.dashboard-sub {
  margin: -6px 0 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.dashboard-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.dashboard-empty a { color: var(--accent-blue-deep); font-weight: 600; }
.dashboard-table-wrap {
  max-height: 220px;
  overflow: auto;
  margin-bottom: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
}
.dashboard-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.dashboard-mini-table th,
.dashboard-mini-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
.dashboard-mini-table th {
  background: var(--surface-blue);
  color: var(--text-muted);
  font-weight: 700;
  position: sticky;
  top: 0;
}
.dashboard-mini-table tr:last-child td { border-bottom: none; }
.dashboard-muted { color: var(--text-muted); font-weight: 500; }
.dashboard-card-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-blue-deep);
  text-decoration: none;
}
.dashboard-card-link:hover { text-decoration: underline; }
.dashboard-net {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.dashboard-net strong { color: var(--text); }
.dashboard-net--debt strong { color: #b54545; }
.dashboard-net--credit strong { color: #2d7a4d; }
.dashboard-balance.is-debt { color: #b54545; font-weight: 700; }
.dashboard-balance.is-credit { color: #2d7a4d; font-weight: 700; }
.dashboard-todo-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.dashboard-todo-input {
  flex: 1;
  min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
}
.dashboard-todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dashboard-todo-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.dashboard-todo-list li:last-child { border-bottom: none; }
.dashboard-todo-list li.is-done .dashboard-todo-label span {
  text-decoration: line-through;
  color: var(--text-muted);
}
.dashboard-todo-toggle { flex: 1; min-width: 0; margin: 0; }
.dashboard-todo-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin: 0;
}
.dashboard-todo-label input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent-blue-deep);
}
.dashboard-todo-del { margin: 0; flex-shrink: 0; }
.dashboard-todo-del .btn { padding: 4px 10px; font-size: 11px; }

@media (max-width: 960px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.summary-box {
  margin-top: 18px;
  background: var(--surface-2);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 420px;
  margin-left: auto;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  border-bottom: 1px dashed var(--border-soft);
  padding-bottom: 6px;
  color: var(--text);
}
.summary-row.total {
  border-top: 2px solid var(--accent-blue);
  margin-top: 10px;
  padding-top: 10px;
  font-size: 18px;
  color: var(--accent-blue-deep);
  border-bottom: none;
}

.tev-toggle {
  width: 34px;
  height: 18px;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--border);
  position: relative;
  background: var(--surface-2);
  transition: 0.25s;
}
.tev-toggle.active {
  background: var(--accent-pink);
  border-color: var(--accent-pink-deep);
}
.tev-toggle::after {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-radius: 50%;
  position: absolute;
  left: 3px;
  top: 2px;
  transition: 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.tev-toggle.active::after { left: 17px; }

.flash, .alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid var(--border);
}
.flash-ok, .alert-ok { background: var(--surface-blue); color: var(--text); }
.flash-err, .alert-err { background: var(--surface-pink); color: var(--accent-pink-deep); }

code {
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--border-soft);
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { flex: none; width: 100%; max-height: none; position: relative; top: 0; }
  .side-nav.side-nav--split {
    flex-direction: column;
    max-height: none;
  }
  .side-nav.side-nav--split .side-nav__col:first-child {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
    padding-bottom: 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-soft);
  }
  .side-nav:not(.side-nav--split) {
    max-height: 420px;
  }
}

/* Yönetici panelleri (super_admin / company_admin) */
.admin-page .container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.admin-page .header {
  background: linear-gradient(135deg, var(--surface-blue) 0%, var(--surface) 50%, var(--surface-pink) 100%);
  color: var(--text);
  padding: 20px 22px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-soft);
}
.admin-page .header h1 { margin: 0; font-size: 1.45rem; }
.admin-page h2 {
  margin-top: 0;
  color: var(--text);
  font-size: 1.1rem;
  border-bottom: 2px solid var(--border-soft);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.btn-edit {
  background: var(--surface-blue);
  color: var(--accent-blue-deep);
  border: 1px solid var(--border);
}
.ent-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.ent-label { font-size: 11px; color: var(--text-muted); margin: 0 0 4px 0; }
.flex-form { display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap; }

/* ——— Koyu tema (html[data-theme="dark"], tercih: evrak-theme) ——— */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #1a1f2c;
  --bg-soft: #222836;
  --surface: #282f40;
  --surface-2: #323a50;
  --surface-blue: #2a3144;
  --surface-pink: #2d2838;
  --border: #3d4a63;
  --border-soft: #3a4358;
  --text: #e8edf5;
  --text-muted: #94a3b8;
  --accent-blue: #8eb4dc;
  --accent-blue-deep: #a8c8ec;
  --accent-pink: #c4a3b5;
  --accent-pink-deep: #e8b4cc;
  --success: #6daf82;
  --danger: #d98a8a;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .app-statusbar {
  background: linear-gradient(90deg, #252b3d 0%, #2d2434 100%);
  border-bottom-color: var(--border);
}

html[data-theme="dark"] .app-statusbar__logout {
  background: var(--surface);
  color: var(--accent-pink-deep);
  border-color: var(--accent-pink);
}

html[data-theme="dark"] .app-statusbar__theme {
  background: var(--surface-2);
  border-color: var(--border);
}

html[data-theme="dark"] .modal {
  background: rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(142, 180, 220, 0.2);
}

html[data-theme="dark"] .btn-gray:hover {
  background: var(--surface-2);
}

html[data-theme="dark"] .admin-page .header {
  background: linear-gradient(135deg, #2a3144 0%, #323a50 50%, #2d2838 100%);
}
