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

:root {
  --radius: 8px;
  --bg: #eef4fb;
  --bg-a: #f7fafe;
  --bg-b: #e9f1fb;
  --text1: #14293d;
  --text2: #586f87;
  --text3: #7c93a8;
  --line: rgba(26, 64, 99, 0.16);
  --line-strong: rgba(26, 64, 99, 0.3);
  --blue: #126fce;
  --blue2: #28a2e6;
  --glass: linear-gradient(165deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.65) 100%);
  --glass-2: linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0%, rgba(255, 255, 255, 0.57) 100%);
  --glass-3: linear-gradient(180deg, rgba(255, 255, 255, 0.66) 0%, rgba(255, 255, 255, 0.5) 100%);
  --topbar-bg: rgba(248, 252, 255, 0.76);
  --input-bg: rgba(255, 255, 255, 0.8);
  --input-line: rgba(26, 64, 99, 0.24);
  --shadow-soft: 0 10px 28px rgba(23, 49, 75, 0.12);
  --shadow-strong: 0 22px 52px rgba(18, 39, 63, 0.18);
  --overlay: rgba(16, 28, 42, 0.38);
  --modal-fade: linear-gradient(180deg, rgba(242, 247, 253, 0) 0%, rgba(242, 247, 253, 0.92) 20%, rgba(242, 247, 253, 1) 100%);
  --icon-stroke: #123a58;
  --icon-line: rgba(20, 53, 82, 0.2);
}

:root[data-theme='dark'] {
  --bg: #08131d;
  --bg-a: #0b1723;
  --bg-b: #09141f;
  --text1: #e7f2ff;
  --text2: #9fb6cd;
  --text3: #6f879e;
  --line: rgba(112, 165, 220, 0.2);
  --line-strong: rgba(112, 165, 220, 0.34);
  --blue: #1377dc;
  --blue2: #2ec8f1;
  --glass: linear-gradient(165deg, rgba(16, 33, 49, 0.86) 0%, rgba(12, 26, 39, 0.74) 100%);
  --glass-2: linear-gradient(180deg, rgba(19, 39, 58, 0.84) 0%, rgba(12, 26, 40, 0.76) 100%);
  --glass-3: linear-gradient(180deg, rgba(16, 33, 49, 0.8) 0%, rgba(12, 26, 39, 0.72) 100%);
  --topbar-bg: rgba(11, 24, 36, 0.74);
  --input-bg: rgba(20, 42, 62, 0.76);
  --input-line: rgba(112, 165, 220, 0.26);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.32);
  --shadow-strong: 0 24px 58px rgba(0, 0, 0, 0.42);
  --overlay: rgba(0, 0, 0, 0.52);
  --modal-fade: linear-gradient(180deg, rgba(14, 27, 40, 0) 0%, rgba(14, 27, 40, 0.9) 20%, rgba(14, 27, 40, 1) 100%);
  --icon-stroke: #e7f2ff;
  --icon-line: rgba(194, 225, 255, 0.24);
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-a) 0%, var(--bg-b) 100%);
  color: var(--text1);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 5% -5%, rgba(39, 164, 227, 0.18) 0%, rgba(39, 164, 227, 0) 34%),
    radial-gradient(circle at 97% 110%, rgba(18, 111, 206, 0.18) 0%, rgba(18, 111, 206, 0) 38%);
  z-index: -1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.24;
  z-index: -1;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 448px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-strong);
}

.login-logo { text-align: center; margin-bottom: 24px; }
.brand-lockup { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.brand-copy { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.brand-copy p { color: var(--text2); font-size: 13px; }
.brand-word {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, #2e84d6 0%, #2ab3ec 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.brand-mark { position: relative; flex: 0 0 auto; }
.brand-mark-lg { width: 164px; height: 136px; }
.brand-mark-sm { width: 52px; height: 40px; }
.brand-stroke, .brand-swoosh { position: absolute; display: block; }
.brand-stroke-main {
  left: 18%;
  bottom: 4%;
  width: 34%;
  height: 84%;
  background: linear-gradient(180deg, #2cf1ff 0%, #149eff 48%, #004cff 100%);
  border-radius: 20px 20px 14px 14px;
  transform: skewX(-18deg) rotate(29deg);
}
.brand-stroke-side {
  right: 13%;
  bottom: 4%;
  width: 37%;
  height: 58%;
  background: linear-gradient(180deg, #2cf1ff 0%, #149eff 48%, #004cff 100%);
  clip-path: polygon(47% 0, 100% 100%, 0 100%);
}
.brand-swoosh {
  right: 13%;
  bottom: 4%;
  width: 32%;
  height: 27%;
  background: linear-gradient(180deg, #ffffff 0%, #d8dceb 52%, #8a93a7 100%);
  border-radius: 100% 0 100% 28%;
  transform: rotate(13deg);
  clip-path: polygon(0 10%, 75% 12%, 100% 100%, 40% 100%, 12% 60%);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text2);
}

.form-group input, .select-control {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text1);
  font-size: 14px;
  padding: 11px 13px;
  outline: none;
}

.form-group input:focus, .select-control:focus { border-color: var(--blue); }

.btn-login, .btn-theme-switch, .btn-logout, .admin-btn, .btn-small {
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s ease;
}

.btn-login {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
}

.btn-login:hover { filter: brightness(1.04); }
.btn-login:disabled { opacity: .56; cursor: default; }

.login-theme-switch {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
}

.btn-theme-switch, .btn-logout, .btn-small {
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--text2);
  padding: 7px 12px;
  font-size: 13px;
}

.btn-theme-switch:hover, .btn-logout:hover, .btn-small:hover { color: var(--text1); border-color: var(--line-strong); }

.admin-btn {
  display: none;
  padding: 7px 14px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  font-size: 13px;
}

.btn-primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--blue), var(--blue2)); }

.err-msg {
  margin-top: 12px;
  border: 1px solid rgba(220, 50, 50, 0.26);
  border-radius: 8px;
  background: rgba(220, 50, 50, 0.12);
  color: #cb3148;
  font-size: 13px;
  padding: 10px 14px;
  display: none;
}

.app { display: none; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 14px rgba(21, 44, 68, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left, .brand-inline { display: flex; align-items: center; min-width: 0; }
.brand-inline { gap: 12px; }
.brand-inline-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-brand-name {
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, #2e84d6 0%, #2ab3ec 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.topbar-panel-label { font-size: 12px; color: var(--text2); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-info { color: var(--text2); font-size: 13px; }
.user-info strong { color: var(--text1); }

.main {
  max-width: 1260px;
  margin: 0 auto;
  padding: 30px 22px 40px;
}

.control-layout {
  display: block;
}

.control-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: min(320px, 86vw);
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: var(--glass-3);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  padding: 12px;
  display: grid;
  gap: 8px;
  align-content: start;
  transform: translateX(-108%);
  transition: transform .22s ease;
  z-index: 24;
}

.control-sidebar.open {
  transform: translateX(0);
}

.sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.sidebar-head strong {
  font-size: 14px;
  color: var(--text1);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: .2s ease;
  z-index: 23;
}

.sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.sidebar-item {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-2);
  color: var(--text2);
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-item.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
}

.control-content { min-width: 0; }
.control-section { display: none; }
.control-section.active { display: block; }

.welcome {
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--glass-3);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.welcome-copy { min-width: 0; }
.welcome-eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.welcome h2 { font-size: 30px; line-height: 1.1; margin-bottom: 6px; }
.welcome p { color: var(--text2); font-size: 14px; line-height: 1.5; }

.welcome-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}

.metric-chip strong {
  color: var(--text1);
  font-size: 13px;
}

.welcome::after {
  content: "Canli Modul Havuzu";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.menu-toolbar {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.menu-toolbar input {
  min-height: 40px;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--glass-2);
  color: var(--text1);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
}

.menu-toolbar input:focus {
  border-color: var(--blue);
}

.menu-toolbar input::placeholder {
  color: var(--text3);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 14px;
}

.app-card {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 18px 18px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  color: inherit;
  text-decoration: none;
  min-height: 176px;
}

.app-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--blue2));
  opacity: 0.82;
}

.app-card::after {
  content: "";
  position: absolute;
  inset: auto -42px -52px auto;
  width: 130px;
  height: 130px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(44, 170, 235, 0.24) 0%, rgba(44, 170, 235, 0) 70%);
  pointer-events: none;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-strong);
}

.app-icon {
  width: 50px;
  height: 50px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid var(--icon-line);
  background: var(--glass-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--icon-stroke);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; line-height: 1.25; }
.app-card p { font-size: 13px; color: var(--text2); line-height: 1.5; padding-right: 34px; }
.app-card.is-hidden { display: none !important; }

.app-arrow {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.admin-panel {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-3);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  display: block;
}

.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.panel-head h3 { font-size: 17px; }
.panel-head p { color: var(--text2); font-size: 13px; margin-top: 4px; }

.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th, .users-table td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; vertical-align: middle; }
.users-table th { color: var(--text2); font-size: 11px; text-transform: uppercase; }
.users-table tbody tr:hover td { background: rgba(42, 142, 223, 0.06); }

.badge {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--text2);
  padding: 3px 8px;
  font-size: 11px;
}

.app-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.muted-inline { color: var(--text3); font-size: 12px; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 18px;
  background: var(--overlay);
}

.modal.open { display: flex; }

.modal-box {
  width: min(520px, 100%);
  margin: 16px auto;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-strong);
}

.modal-box-wide { width: min(1080px, 100%); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-grid-spaced { margin-top: 16px; }
.modal-grid .full { grid-column: 1 / -1; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  position: sticky;
  bottom: 0;
  background: var(--modal-fade);
  padding-top: 14px;
}

.role-note { color: var(--text2); font-size: 13px; line-height: 1.5; }

.permission-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
.perm-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.perm-tab {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.perm-tab.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
}
.perm-panels { min-width: 0; }
.perm-card { border: 1px solid var(--line); border-radius: 8px; background: var(--glass-2); padding: 12px; }
.perm-card.hidden { display: none; }
.perm-card.disabled { opacity: .58; }
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.perm-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.perm-role-select { width: 170px; flex: 0 0 auto; }
.perm-desc { color: var(--text2); font-size: 12px; line-height: 1.5; margin-top: 6px; }
.perm-details { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.perm-details summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 12px;
  text-transform: uppercase;
}
.perm-details summary::-webkit-details-marker { display: none; }
.perm-summary-actions { display: inline-flex; align-items: center; gap: 8px; }
.perm-link { background: transparent; border: 0; color: var(--blue); cursor: pointer; font-size: 12px; padding: 0; }
.perm-pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin-top: 10px; }
.page-check { display: flex; align-items: flex-start; gap: 8px; color: var(--text1); font-size: 12px; line-height: 1.4; }
.page-check input { margin-top: 2px; }

.fatura-icon { background: rgba(28, 119, 216, 0.16); }
.depo-icon { background: rgba(36, 169, 110, 0.16); }
.ihale-icon { background: rgba(216, 146, 33, 0.16); }
.oda-icon { background: rgba(35, 170, 184, 0.16); }
.envanter-icon { background: rgba(110, 129, 196, 0.16); }
.santiye-icon { background: rgba(210, 85, 79, 0.16); }
.satinalma-icon { background: rgba(35, 142, 216, 0.16); }
.sozlesme-icon { background: rgba(74, 129, 178, 0.16); }
.teknikservis-icon { background: rgba(36, 165, 117, 0.16); }
.users-icon { background: rgba(126, 97, 210, 0.16); }

@media (max-width: 820px) {
  .topbar { padding: 12px 14px; }
  .topbar-panel-label, .user-info { display: none; }
  .main { padding: 20px 14px 30px; }
  .welcome { grid-template-columns: 1fr; gap: 10px; }
  .welcome-metrics { justify-content: flex-start; }
  .welcome h2 { font-size: 25px; }
  .menu-toolbar { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .apps-grid { grid-template-columns: 1fr; }
  .modal { padding: 10px; }
  .modal-box { margin: 0 auto; max-height: calc(100vh - 20px); padding: 16px; }
  .modal-grid { grid-template-columns: 1fr; }
  .perm-head { flex-direction: column; align-items: stretch; }
  .perm-role-select { width: 100%; }
  .perm-pages, .permission-grid { grid-template-columns: 1fr; }
}
