/* ====== Kayalar Yönetim Paneli — modern tasarım sistemi ====== */
:root {
  --brand: #2BA84A;
  --brand-dark: #1E7A35;
  --brand-light: #4ECB6F;
  --brand-soft: #E8F5EC;
  --brand-softer: #F1F9F3;

  --bg: #F6F8F7;
  --surface: #FFFFFF;
  --surface-2: #FAFBFB;
  --ink: #0F1612;
  --ink-2: #5E6B64;
  --ink-3: #9CA8A1;
  --border: #E7ECE9;
  --border-2: #DCE3DF;

  --danger: #E53E3E;
  --danger-soft: #FDECEC;
  --warn: #E28A00;
  --warn-soft: #FCF2E1;
  --info: #2B75E5;
  --info-soft: #E9F1FD;
  --ok: #10B981;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15,22,18,.05), 0 1px 3px rgba(15,22,18,.04);
  --shadow-md: 0 4px 12px rgba(15,22,18,.07), 0 2px 4px rgba(15,22,18,.04);
  --shadow-lg: 0 12px 32px rgba(15,22,18,.12), 0 4px 8px rgba(15,22,18,.06);
  --sidebar-w: 262px;
  --topbar-h: 62px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 13.5px; color: var(--ink); }
a { color: var(--brand-dark); }

.mark { display: inline-flex; }
.mark svg { width: 100%; height: 100%; }

/* ===== LOGIN ===== */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 15% -10%, var(--brand-soft), transparent),
    radial-gradient(900px 500px at 110% 110%, var(--brand-softer), transparent),
    var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 34px 30px; box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-logo .mark {
  width: 44px; height: 44px; background: var(--brand); border-radius: 13px;
  align-items: center; justify-content: center; padding: 7px;
  box-shadow: 0 6px 16px rgba(43,168,74,.35);
}
.login-logo b { font-size: 16px; font-weight: 800; letter-spacing: -.3px; display: block; }
.login-logo span { font-size: 10px; color: var(--ink-3); letter-spacing: 2px; font-weight: 700; }
.login-card h1 { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.login-card .sub { color: var(--ink-2); font-size: 13px; margin: 4px 0 22px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); transition: .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field input:disabled, .field textarea:disabled { background: #F0F3F1; color: var(--ink-2); cursor: not-allowed; }
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 11px; color: var(--ink-3); margin-top: 5px; line-height: 1.4; }
.err-text { color: var(--danger); font-size: 12px; margin-bottom: 12px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1.5px solid transparent;
  font-size: 13px; font-weight: 600; transition: .15s; white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(43,168,74,.28); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #FBD9D9; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===== SHELL ===== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 11px; padding: 16px 18px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.brand .mark {
  width: 38px; height: 38px; background: var(--brand); border-radius: 11px;
  align-items: center; justify-content: center; padding: 6px;
  box-shadow: 0 4px 12px rgba(43,168,74,.3);
}
.brand b { font-size: 14px; font-weight: 800; letter-spacing: -.2px; line-height: 1.1; }
.brand span { font-size: 9px; color: var(--ink-3); letter-spacing: 2px; font-weight: 700; }

.nav-search { padding: 12px 14px 4px; flex-shrink: 0; }
.nav-search input {
  width: 100%; padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px;
}
.nav-search input:focus { outline: none; border-color: var(--brand); background: #fff; }

.nav-scroll { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.nav-group {
  font-size: 10px; font-weight: 700; color: var(--ink-3); letter-spacing: 1.2px;
  text-transform: uppercase; padding: 14px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8.5px 10px; border: none; background: transparent; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13px; font-weight: 500; transition: .12s; margin-bottom: 1px;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav-item .ico { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item.logout { color: var(--danger); }
.nav-item.logout:hover { background: var(--danger-soft); }
.nav-foot { padding: 8px 10px; border-top: 1px solid var(--border); flex-shrink: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.topbar .count {
  font-size: 11px; color: var(--ink-2); background: var(--surface-2);
  padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border); font-weight: 600;
}
.topbar .grow { flex: 1; }
#toolbar { display: flex; align-items: center; gap: 8px; }

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 6px 5px 10px;
  border-radius: 22px; border: 1px solid var(--border); background: var(--surface);
  transition: .15s;
}
.user-chip:hover { background: var(--surface-2); }
.user-chip .av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.user-chip .un { font-size: 12.5px; font-weight: 600; line-height: 1.15; }
.user-chip .ur { font-size: 10px; color: var(--ink-3); }
.user-menu {
  position: absolute; top: calc(var(--topbar-h) - 6px); right: 22px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 190px; padding: 6px; display: none;
}
.user-menu.open { display: block; }
.user-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 11px; border: none; background: transparent; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink-2); font-weight: 500;
}
.user-menu button:hover { background: var(--surface-2); color: var(--ink); }
.user-menu .sep { height: 1px; background: var(--border); margin: 4px 6px; }

.content { flex: 1; padding: 22px; overflow-y: auto; }

/* ===== SEARCH & FILTERS ===== */
.search { display: flex; align-items: center; gap: 7px; background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; }
.search input { border: none; background: transparent; width: 190px; }
.search input:focus { outline: none; }
.search .ico { color: var(--ink-3); }
.flt { padding: 8px 11px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--surface); font-size: 12.5px; color: var(--ink-2); }
.flt:focus { outline: none; border-color: var(--brand); }

/* ===== DASHBOARD ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -.8px; line-height: 1; }
.stat .l { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.stat.accent { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); border: none; color: #fff; }
.stat.accent .l { color: rgba(255,255,255,.9); }
.stat.warn-stat .n { color: var(--warn); }

.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 20px 0 12px; text-transform: uppercase; letter-spacing: .5px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.dash-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); transition: .15s; cursor: pointer;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand-light); }
.dash-card .ico { font-size: 24px; margin-bottom: 10px; }
.dash-card .t { font-size: 13.5px; font-weight: 700; }
.dash-card .g { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ===== TABLE ===== */
.card-table {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-table .scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .5px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--brand-softer); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  width: 30px; height: 30px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; transition: .12s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.icon-btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.swatch-dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 7px; vertical-align: -2px; border: 1px solid var(--border-2); }
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge.green { background: var(--brand-soft); color: var(--brand-dark); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.grey { background: #EEF1F0; color: var(--ink-2); }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.pagination .info { font-size: 12px; color: var(--ink-2); }
.pagination .pages { display: flex; gap: 5px; }
.pagination .pg { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pagination .pg:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-dark); }
.pagination .pg.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .pg:disabled { opacity: .4; cursor: default; }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 10px; }

/* ===== CENTER / SPINNER ===== */
.center { display: flex; align-items: center; justify-content: center; padding: 60px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== DRAWER ===== */
.overlay { position: fixed; inset: 0; background: rgba(15,22,18,.4); opacity: 0; pointer-events: none; transition: .2s; z-index: 50; backdrop-filter: blur(2px); }
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 94vw;
  background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1); z-index: 60; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-head h3 { font-size: 15px; font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface-2); }

.checkbox { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); }

/* image picker */
.img-pick { display: flex; flex-direction: column; gap: 8px; }
.img-prev { width: 90px; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.img-drop { display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px; border: 1.5px dashed var(--border-2); border-radius: var(--radius-sm); color: var(--ink-2); font-size: 12.5px; cursor: pointer; background: var(--surface-2); width: fit-content; }
.img-drop:hover { border-color: var(--brand); color: var(--brand-dark); }
.img-url { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12px; }
.img-clear { width: fit-content; padding: 5px 10px; font-size: 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink-2); }

/* ===== TOAST ===== */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 11px 18px; border-radius: 22px; font-size: 13px; font-weight: 600; color: #fff;
  box-shadow: var(--shadow-lg); animation: toastIn .25s ease; display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: var(--brand-dark); }
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ===== MODAL (confirm) ===== */
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15,22,18,.4); backdrop-filter: blur(2px); }
.modal.open { display: flex; }
.modal-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; padding: 24px; }
.modal-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.modal-card p { font-size: 13px; color: var(--ink-2); margin-bottom: 18px; line-height: 1.5; }
.modal-card .actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== SPECIAL PAGES ===== */
.panel-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px; margin-bottom: 16px; max-width: 640px;
}
.panel-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.panel-card .desc { font-size: 12.5px; color: var(--ink-2); margin-bottom: 18px; }

/* role menu picker */
.perm-groups { display: flex; flex-direction: column; gap: 14px; }
.perm-group-title { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.perm-group-title label { font-size: 10px; color: var(--brand-dark); cursor: pointer; font-weight: 600; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.perm-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px; cursor: pointer; transition: .12s; }
.perm-item:hover { border-color: var(--brand-light); }
.perm-item.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); font-weight: 600; }
.perm-item input { accent-color: var(--brand); }

.qr-result { margin-top: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.qr-codes-box { font-family: monospace; font-size: 11.5px; max-height: 200px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 10px; line-height: 1.7; }

/* mobile */
.hamburger { display: none; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); align-items: center; justify-content: center; font-size: 16px; }
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 70; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .content { padding: 16px; }
  .search input { width: 130px; }
}
