/* DIAGONAL Proje Takip — Bootstrap 5 theme */
:root {
  color-scheme: dark;
  --app-bg: #0b0f18;
  --sidebar-bg: #101a2c;
  --surface: #121b2d;
  --surface-raised: #182235;
  --surface-hover: #202b40;
  --border: #202a3d;
  --text: #edf1f8;
  --muted: #8c9bb2;
  --accent: #ff7415;
  --success: #00c991;
  --warning: #ffbd27;
  --info: #10a8e0;
  --sidebar-width: 260px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--app-bg); }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--app-bg);
  color: var(--text);
  font: 15px/1.5 "Nunito", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-decoration: none; }
a:hover { color: #56caff; }
::selection { color: #111; background: var(--accent); }

/* Main navigation */
.sidebar {
  position: fixed;
  z-index: 1020;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
}
.brand {
  display: block;
  padding: 20px 23px;
  border-bottom: 1px solid var(--border);
  color: #fff;
  line-height: 1.2;
  text-decoration: none;
}
.brand img { display: block; width: 100%; max-width: 212px; height: auto; }
.brand:hover { color: #fff; }
.sidebar nav { display: grid; gap: 4px; padding: 14px 10px; }
.sidebar nav.collapse:not(.show) { display: grid; }
.sidebar-head { display: contents; }
.nav-toggle { display: none; }
.mobile-account { display: none; }
.sidebar .nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 8px;
  color: #9aa9bf;
  font-size: 14px;
  transition: color .16s ease, background-color .16s ease;
}
.sidebar .nav-link:hover { color: #fff; background: #19253a; }
.sidebar .nav-link.active { color: var(--accent); background: #39291f; font-weight: 600; }
.userbox {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 17px 22px 14px;
  border-top: 1px solid var(--border);
}
.userbox b { font-size: 14px; font-weight: 600; }
.userbox small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; }
.userbox strong { color: var(--accent); font-size: 11px; letter-spacing: 1px; }
.userbox .btn { justify-self: start; padding: 7px 0 0; color: #c4cfdf; text-decoration: none; }
.userbox .btn:hover { color: var(--accent); }

/* Page frame and headings */
.main { width: min(100% - var(--sidebar-width), 1900px); margin-left: var(--sidebar-width); padding: 28px 34px 48px; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 75px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.top h1 { margin: 0 0 4px; font-size: clamp(23px, 2vw, 31px); font-weight: 650; letter-spacing: -.55px; }
.top p { margin: 0; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 0 0 auto; }
.deadline-toggle, .projects-count { display: inline-flex; min-height: 38px; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: #0d1421; color: var(--text); font: 600 13px/1.2 "Nunito", sans-serif; white-space: nowrap; }
.deadline-toggle { border-color: #75511b; background: #251e13; color: #ffd348; }
.deadline-toggle::after { margin-left: 2px; }
.deadline-toggle:hover, .deadline-toggle.show { border-color: #a87822; background: #302514; color: #ffe082; }
.deadline-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.projects-count { border-color: #202a3d; background: transparent; font-family: ui-monospace, monospace; }
.projects-count b { color: #fff; }
.deadline-menu { width: min(390px, calc(100vw - 28px)); max-height: min(70vh, 520px); overflow-y: auto; padding: 8px; border: 1px solid #2a3549; border-radius: 13px; background: #121b2d; box-shadow: 0 18px 48px #0009; }
.deadline-menu-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); }
.deadline-menu-head strong { font-size: 15px; }
.deadline-menu-head span { min-width: 25px; padding: 2px 7px; border-radius: 20px; background: #202a3d; color: var(--muted); font: 700 12px ui-monospace, monospace; text-align: center; }
.deadline-group-title { padding: 10px 10px 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.deadline-group-title.group-overdue { color: #ff727c; }
.deadline-group-title.group-today { color: #ffd348; }
.deadline-group-title.group-upcoming { color: #62c8ed; }
.deadline-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--text); white-space: normal; }
.deadline-item:hover, .deadline-item:focus { background: #202a3d; color: #fff; }
.deadline-item b, .deadline-item small { display: block; }
.deadline-item b { color: var(--info); font: 700 12px ui-monospace, monospace; }
.deadline-item small { max-width: 245px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.deadline-item time { flex: 0 0 auto; color: #d5deea; font: 600 12px ui-monospace, monospace; }
.deadline-empty { padding: 18px 10px; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted) !important; }

/* Bootstrap cards and dashboard */
.panel, .metric {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 6px 20px #0000000a;
}
.panel h2 { margin: 0 0 18px; font-size: 18px; font-weight: 570; letter-spacing: -.15px; }
.metric { display: flex; min-height: 124px; flex-direction: column; justify-content: center; gap: 7px; color: var(--muted); }
.metric span { font-size: 12px; font-weight: 550; letter-spacing: .04em; text-transform: uppercase; }
.metric b { color: var(--text); font: 700 clamp(22px, 2vw, 28px)/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.row > [class*="col"] > .panel { height: calc(100% - 18px); }
.stage-line { display: flex; justify-content: space-between; gap: 14px; margin: 13px 5px 6px; font-size: 14px; }
.stage-line span:last-child { color: var(--muted); font-family: ui-monospace, monospace; }
.progress { height: 7px; overflow: hidden; border-radius: 8px; background: #202a3d; }
.progress-bar { border-radius: inherit; background: var(--accent); }
.recent { display: block; padding: 12px 4px; border-bottom: 1px solid var(--border); color: var(--text); }
.recent:last-child { border-bottom: 0; }
.recent b { color: var(--info); font-family: ui-monospace, monospace; }
.recent small { display: block; margin-top: 4px; color: var(--muted); }
.warning-card { height: 100%; padding: 13px 14px; border: 1px solid #854816; border-radius: 9px; background: #372313; }
.warning-card b { color: #ffd5ad; font-family: ui-monospace, monospace; }
.warning-card small { display: block; margin-top: 6px; color: #ddb88f; }

/* Tables and workflow status */
.table-responsive { border-radius: 14px; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 14px 12px; vertical-align: middle; }
.table thead th { color: #a9b6c9; font-size: 13px; font-weight: 550; white-space: nowrap; }
.table tbody tr { transition: background-color .14s ease; }
.table tbody tr:hover > * { --bs-table-bg: #ffffff06; }
.table a { font-weight: 600; }
.badge-stage, .stage-pill { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #164967; border-radius: 30px; background: #10283a; color: #64c7ef; font-size: 11px; font-weight: 650; letter-spacing: .025em; white-space: nowrap; }
.badge-stage { padding: 6px 10px; }
.stage-pill { min-height: 36px; padding: 7px 12px; border-color: var(--border); background: var(--surface-raised); cursor: pointer; transition: .15s ease; }
.stage-pill:hover { border-color: #697a94; color: #fff; }
.stage-pill.selected { border-color: var(--accent); background: #39291f; color: var(--accent); }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.detail-grid small { display: block; margin-bottom: 5px; color: var(--muted); }
.detail-grid > div > div { overflow-wrap: anywhere; }
.orange { color: var(--warning); }

/* Form controls and buttons, while retaining Bootstrap behavior */
.btn { border-radius: 8px; font-family: inherit; font-weight: 650; }
.form-control, .form-select { font-family: inherit; }
.btn-orange { border: 1px solid var(--accent); background: var(--accent); color: #17110d; font-weight: 650; }
.btn-orange:hover, .btn-orange:focus-visible { border-color: #ff8a3a; background: #ff8a3a; color: #17110d; }
.form-control, .form-select {
  min-height: 42px;
  border-color: #273249;
  background-color: var(--surface-raised);
  color: var(--text);
}
.form-control:focus, .form-select:focus { border-color: #248db2; background-color: var(--surface-raised); color: #fff; box-shadow: 0 0 0 .2rem #248db244; }
.form-control::placeholder { color: #8190a7; }
textarea.form-control { min-height: 92px; }
label { display: inline-block; margin-bottom: 6px; color: #dce3ed; font-size: 14px; }
.form-select option { background: var(--surface-raised); color: var(--text); }

/* Dialogs, alerts, and login */
.modal-content { overflow: hidden; border: 1px solid #2a3549; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px #0008; }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { font-size: 20px; font-weight: 600; }
.alert { border-radius: 10px; }
.alert-danger, .alert-warning { border-color: #67343a; background: #3b2023; color: #ffd3d3; }
.app-toast { display: flex; width: min(420px, calc(100vw - 28px)); align-items: center; gap: 11px; padding: 5px 8px 5px 15px; border: 1px solid #075b3a; border-radius: 11px; background: #002313; color: #4fe0a2; box-shadow: 0 12px 36px #0008; }
.app-toast .toast-body { display: flex; flex: 1; align-items: center; gap: 11px; padding: 11px 0; font-size: 15px; font-weight: 750; }
.toast-check { display: grid; width: 22px; height: 22px; flex: 0 0 auto; place-items: center; border: 2px solid currentColor; border-radius: 50%; font-size: 14px; line-height: 1; }
.app-toast.toast-error { border-color: #70383e; background: #2c1116; color: #ff838b; }
.app-toast .btn-close { filter: invert(1); opacity: .65; }
.app-toast .btn-close:hover { opacity: 1; }
.login-wrap { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 25%, #172238 0%, var(--app-bg) 58%); }
.login-card { width: min(430px, 100%); padding: 30px; border: 1px solid #263248; border-radius: 16px; background: var(--surface); box-shadow: 0 24px 70px #0005; }
.login-card .brand { margin: 0 0 24px; padding: 0 0 17px; border-bottom-color: var(--border); }
.login-card .brand img { max-width: 270px; }
.login-card h1 { margin-bottom: 4px; font-size: 24px; font-weight: 650; }

:focus-visible { outline: 2px solid #42bce9; outline-offset: 2px; }

@media (max-width: 1050px) {
  :root { --sidebar-width: 220px; }
  .main { padding-right: 22px; padding-left: 22px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { position: sticky; top: 0; width: 100%; overflow: visible; }
  .sidebar-head { display: flex; min-height: 58px; align-items: center; justify-content: space-between; }
  .sidebar .brand { width: min(72vw, 240px); padding: 12px 17px; border: 0; }
  .sidebar .brand img { max-width: 200px; }
  .nav-toggle {
    display: grid;
    width: 46px;
    height: 46px;
    align-content: center;
    justify-items: center;
    gap: 5px;
    margin-right: 14px;
    border: 1px solid #283349;
    border-radius: 10px;
    background: #121b2d;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
  }
  .nav-toggle span {
    display: block;
    width: 19px;
    height: 1.5px;
    border-radius: 2px;
    background: #dce3ed;
    transition: transform .22s ease, opacity .16s ease, background-color .2s ease;
  }
  .nav-toggle:hover { border-color: #a74d1c; background: #182235; }
  .nav-toggle:hover span, .nav-toggle[aria-expanded="true"] span { background: var(--accent); }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { transform: scaleX(.2); opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
  .nav-toggle:active { transform: scale(.96); }
  .nav-toggle:focus-visible { outline: 2px solid #49b8e6; outline-offset: 3px; }
  .sidebar nav, .sidebar nav.collapse:not(.show) { display: none; }
  .sidebar nav.show { display: grid; gap: 3px; padding: 5px 12px 13px; border-top: 1px solid var(--border); }
  .sidebar .nav-link { min-height: 40px; padding: 9px 12px; font-size: 14px; }
  .userbox { display: none; }
  .mobile-account { display: grid; gap: 3px; margin: 7px 0 0; padding: 12px; border-top: 1px solid var(--border); }
  .mobile-account small { color: var(--muted); }
  .mobile-account strong { color: var(--accent); font-size: 11px; letter-spacing: 1px; }
  .mobile-account .btn { justify-self: start; padding: 5px 0 0; color: #c4cfdf; text-decoration: none; }
  .main { width: 100%; margin: 0; padding: 20px 14px 36px; }
  .top { align-items: flex-start; gap: 12px; margin-bottom: 17px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-start; gap: 7px; }
  .top h1 { font-size: 23px; }
  .top .btn { flex: 0 0 auto; font-size: 13px; }
  .panel, .metric { padding: 16px; }
  .metric { min-height: 105px; }
  .row > [class*="col"] > .panel { height: auto; }
  .table { min-width: 760px; }
  .panel.table-responsive { padding: 8px 12px 13px; }
  .modal-dialog { margin: 12px; }
  .modal-body { max-height: calc(100dvh - 150px); overflow-y: auto; }
  .detail-grid { gap: 16px; }
}
@media (max-width: 420px) {
  .detail-grid { grid-template-columns: 1fr 1fr; gap: 14px 10px; }
  .login-card { padding: 23px; }
  .top { flex-direction: column; }
  .top-actions { width: 100%; }
  .top .btn { align-self: flex-start; }
  .stage-pill { min-height: 34px; padding: 6px 9px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
