:root {
  --mt-bg: #f5f5f7;
  --mt-surface: rgba(255, 255, 255, 0.82);
  --mt-surface-solid: #ffffff;
  --mt-text: #1d1d1f;
  --mt-muted: #6e6e73;
  --mt-line: rgba(29, 29, 31, 0.09);
  --mt-blue: #0071e3;
  --mt-blue-hover: #0077ed;
  --mt-green: #248a3d;
  --mt-red: #d70015;
  --mt-yellow: #a05a00;
  --mt-radius: 20px;
  --mt-radius-sm: 13px;
  --mt-shadow: 0 12px 36px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --bs-primary: #0071e3;
  --bs-primary-rgb: 0, 113, 227;
  --bs-body-color: #1d1d1f;
  --bs-body-bg: #f5f5f7;
  --bs-border-color: rgba(29, 29, 31, 0.09);
  --bs-link-color: #0066cc;
  --bs-link-hover-color: #004f9f;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--mt-bg); }

body.app-body {
  min-height: 100vh;
  margin: 0;
  color: var(--mt-text);
  background:
    radial-gradient(circle at 12% -8%, rgba(0, 113, 227, 0.12), transparent 27rem),
    radial-gradient(circle at 92% 10%, rgba(175, 82, 222, 0.08), transparent 25rem),
    var(--mt-bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a { transition: color .18s ease, opacity .18s ease; }

.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 64px;
  padding: .55rem 0;
  background: rgba(20, 20, 22, .88);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}

.app-navbar .container { max-width: 1440px; }

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: #fff;
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: -.025em;
}

.navbar-brand:hover { color: #fff; opacity: .88; }

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #2997ff, #0066cc);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 9px;
  box-shadow: inset 0 1px rgba(255, 255, 255, .25), 0 4px 12px rgba(0, 113, 227, .3);
}

.app-navbar .navbar-nav { gap: .2rem; }

.app-navbar .nav-link {
  padding: .48rem .72rem !important;
  color: rgba(255, 255, 255, .68);
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 520;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus,
.app-navbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, .11);
}

.app-navbar .nav-link.nav-create-event {
  color: #fff;
  background: rgba(10, 132, 255, .92);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px rgba(255, 255, 255, .22), 0 5px 16px rgba(0, 113, 227, .28);
}

.app-navbar .nav-link.nav-create-event:hover,
.app-navbar .nav-link.nav-create-event:focus {
  color: #fff;
  background: #168cff;
  transform: translateY(-1px);
}

.navbar-toggler {
  padding: .35rem .5rem;
  border: 0;
  border-radius: 10px;
  box-shadow: none !important;
}

.notification-link { display: grid; place-items: center; min-width: 38px; }
.notification-bell { display: block; }
.dropdown-toggle::after { display: none; }

.user-cluster { padding-left: .85rem; border-left: 1px solid rgba(255, 255, 255, .14); }
.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 700;
}
.user-name { max-width: 180px; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }

.app-main { max-width: 1440px; padding-top: 2.25rem; padding-bottom: 4rem; }

h1, h2, h3, h4, h5, h6 { color: var(--mt-text); font-weight: 650; letter-spacing: -.035em; }
h1.h2, .h2 { font-size: clamp(1.7rem, 2.4vw, 2.25rem); }
.text-secondary { color: var(--mt-muted) !important; }

.page-eyebrow {
  margin-bottom: .4rem;
  color: var(--mt-blue);
  font-size: .72rem;
  font-weight: 720;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.card {
  overflow: hidden;
  background: var(--mt-surface);
  border: 1px solid rgba(255, 255, 255, .75) !important;
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.card-header,
.card-footer {
  padding: 1.05rem 1.25rem;
  background: rgba(255, 255, 255, .45) !important;
  border-color: var(--mt-line);
}

.card-body { padding: 1.35rem; }

.metric-card { position: relative; min-height: 148px; }
.metric-card::after {
  position: absolute;
  top: -28px;
  right: -30px;
  width: 105px;
  height: 105px;
  background: var(--metric-glow, rgba(0, 113, 227, .12));
  border-radius: 50%;
  content: "";
  filter: blur(2px);
}
.metric-card .card-body { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; }
.metric-label { color: var(--mt-muted); font-size: .78rem; font-weight: 620; letter-spacing: .015em; }
.metric-value { margin: .3rem 0 .15rem; font-size: 2.45rem; font-weight: 680; letter-spacing: -.055em; line-height: 1; }
.metric-detail { margin-top: auto; color: var(--mt-muted); font-size: .8rem; }
.metric-card.tasks { --metric-glow: rgba(255, 149, 0, .14); }
.metric-card.payments { --metric-glow: rgba(52, 199, 89, .14); }
.metric-card.shortcut { --metric-glow: rgba(175, 82, 222, .12); }

.btn {
  min-height: 40px;
  padding: .5rem .9rem;
  border-radius: 11px;
  font-size: .88rem;
  font-weight: 610;
  letter-spacing: -.01em;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { min-height: 32px; padding: .34rem .68rem; border-radius: 9px; font-size: .79rem; }
.btn-primary { background: var(--mt-blue); border-color: var(--mt-blue); box-shadow: 0 5px 13px rgba(0, 113, 227, .18); }
.btn-primary:hover, .btn-primary:focus { background: var(--mt-blue-hover); border-color: var(--mt-blue-hover); box-shadow: 0 7px 18px rgba(0, 113, 227, .25); }
.btn-outline-primary { color: var(--mt-blue); background: rgba(0, 113, 227, .06); border-color: rgba(0, 113, 227, .2); }
.btn-outline-secondary { color: #3a3a3c; background: rgba(118, 118, 128, .08); border-color: rgba(60, 60, 67, .14); }
.btn-success { background: var(--mt-green); border-color: var(--mt-green); }

.form-label { margin-bottom: .42rem; color: #3a3a3c; font-size: .8rem; font-weight: 620; }
.form-control,
.form-select {
  min-height: 44px;
  padding: .58rem .78rem;
  color: var(--mt-text);
  background-color: rgba(255, 255, 255, .82);
  border: 1px solid rgba(60, 60, 67, .16);
  border-radius: 11px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .025);
  font-size: .9rem;
}
.form-select-sm { min-height: 38px; padding-top: .4rem; padding-bottom: .4rem; }
.form-control:focus,
.form-select:focus {
  background-color: #fff;
  border-color: rgba(0, 113, 227, .72);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}
textarea.form-control { min-height: 110px; }
.form-text { color: var(--mt-muted); font-size: .75rem; }
.form-check-input { width: 1.15rem; height: 1.15rem; border-color: rgba(60, 60, 67, .28); }

.task-template-section {
  padding: 1rem;
  background: rgba(118, 118, 128, .045);
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 16px;
}
.task-template-count {
  padding: .34rem .62rem;
  color: var(--mt-muted);
  background: rgba(118, 118, 128, .09);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
}
.task-template-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.task-template-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  min-width: 0;
  padding: .82rem .9rem;
  background: rgba(255, 255, 255, .8);
  border: 1px solid rgba(60, 60, 67, .12);
  border-radius: 13px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.task-template-option:hover { background: #fff; border-color: rgba(0, 113, 227, .28); }
.task-template-option:has(input:checked) {
  background: rgba(0, 113, 227, .065);
  border-color: rgba(0, 113, 227, .3);
  box-shadow: 0 4px 14px rgba(0, 113, 227, .06);
}
.task-template-option:has(input:focus-visible) {
  outline: 3px solid rgba(0, 113, 227, .22);
  outline-offset: 2px;
}
.task-template-option input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.task-template-option-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: .22rem; }
.task-template-title { color: var(--mt-text); font-size: .86rem; font-weight: 620; line-height: 1.3; }
.task-template-deadline { color: var(--mt-muted); font-size: .74rem; line-height: 1.35; }
.task-template-empty { grid-column: 1 / -1; padding: 1rem; color: var(--mt-muted); text-align: center; }

.table { --bs-table-bg: transparent; --bs-table-hover-bg: rgba(0, 113, 227, .035); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .9rem 1rem; border-bottom-color: var(--mt-line); }
.table thead th {
  color: var(--mt-muted);
  background: rgba(118, 118, 128, .045);
  border-bottom-width: 1px;
  font-size: .71rem;
  font-weight: 720;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table a { font-weight: 590; text-decoration: none; }
.table-danger { --bs-table-bg: rgba(255, 59, 48, .065); --bs-table-hover-bg: rgba(255, 59, 48, .1); }
.table-warning { --bs-table-bg: rgba(255, 204, 0, .075); --bs-table-hover-bg: rgba(255, 204, 0, .12); }

.badge { padding: .42em .68em; border-radius: 999px; font-size: .7rem; font-weight: 680; letter-spacing: .005em; }
.text-bg-secondary { color: #545458 !important; background: rgba(118, 118, 128, .13) !important; }
.text-bg-success { color: #176c2d !important; background: rgba(52, 199, 89, .14) !important; }
.text-bg-warning { color: #7a4b00 !important; background: rgba(255, 204, 0, .18) !important; }
.text-bg-danger { color: #0A84FF !important; background: rgba(255, 255, 255, 1) !important; }

.alert {
  border: 1px solid transparent;
  border-radius: var(--mt-radius-sm);
  box-shadow: none;
  font-size: .88rem;
}
.alert-info { color: #174c73; background: rgba(90, 200, 250, .12); border-color: rgba(90, 200, 250, .18); }
.alert-warning { color: #6f4800; background: rgba(255, 204, 0, .12); border-color: rgba(255, 204, 0, .18); }

.list-group-item {
  padding: 1rem 1.2rem;
  background: transparent;
  border-color: var(--mt-line);
}
.list-group-item-action { transition: background-color .15s ease, padding-left .15s ease; }
.list-group-item-action:hover { padding-left: 1.28rem; background: rgba(0, 113, 227, .04); }
.list-group-item-danger { color: inherit; background: rgba(255, 59, 48, .065); }
.list-group-item-warning { color: inherit; background: rgba(255, 204, 0, .075); }

.dropdown-menu {
  padding: .5rem;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .16) !important;
  backdrop-filter: blur(24px);
}
.dropdown-item { padding: .65rem .75rem; border-radius: 10px; }
.dropdown-item:hover { background: rgba(0, 113, 227, .07); }
.dropdown-header { color: var(--mt-muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.notification-menu { min-width: 22rem; max-width: min(22rem, calc(100vw - 2rem)); }
.btn-telegram,
.telegram-connected {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #fff;
  background: #229ed9;
  border-color: #229ed9;
}
.btn-telegram:hover,
.btn-telegram:focus {
  color: #fff;
  background: #168dcc;
  border-color: #168dcc;
}
.telegram-connected { background: #248a3d; border-color: #248a3d; }
.telegram-launch-shell { display: grid; min-height: calc(100vh - 170px); place-items: center; }
.telegram-launch-card { width: min(100%, 440px); }
.telegram-launch-card .card-body { padding: 2.4rem; }
.telegram-launch-icon {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 1.25rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #38b4ea, #168dcc);
  border-radius: 21px;
  box-shadow: 0 12px 28px rgba(34, 158, 217, .28);
}

.nav-tabs { gap: .25rem; padding: .3rem; background: rgba(118, 118, 128, .09); border: 0; border-radius: 13px; }
.nav-tabs .nav-link { margin: 0; padding: .52rem .85rem; color: var(--mt-muted); border: 0; border-radius: 9px; font-size: .83rem; font-weight: 620; }
.nav-tabs .nav-link:hover { color: var(--mt-text); }
.nav-tabs .nav-link.active { color: var(--mt-text); background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.tab-content > .tab-pane { padding-top: .2rem; }

.modal-content { background: rgba(255, 255, 255, .95); border: 1px solid rgba(255, 255, 255, .8); border-radius: 22px; box-shadow: 0 28px 80px rgba(0, 0, 0, .24); backdrop-filter: blur(30px); }
.modal-header, .modal-footer { border-color: var(--mt-line); }

.pagination { gap: .35rem; }
.page-link { color: var(--mt-text); background: rgba(255, 255, 255, .76); border: 1px solid var(--mt-line); border-radius: 9px !important; }

.company-picker-menu {
  width: 100%;
  max-height: min(25rem, 60vh);
  overflow: hidden;
  border-radius: 14px;
}
.company-picker-toggle { padding-right: 2.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-picker-search { padding: .65rem; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--mt-line); }
.company-picker-options { max-height: min(19rem, 48vh); padding: .35rem; overflow-y: auto; }
.company-picker-option { margin: .1rem 0; padding: .55rem .65rem; border-radius: 9px; }
.company-picker-option.active { color: var(--mt-blue); background: rgba(0, 113, 227, .1); }
.company-picker-new {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: .35rem;
  color: var(--mt-blue);
  font-weight: 650;
  background: #fff;
  border-bottom: 1px solid var(--mt-line);
}
.company-picker-empty { padding: 1rem .65rem; color: var(--mt-muted); text-align: center; }

.calendar-table { min-width: 760px; table-layout: fixed; }
.calendar-table > :not(caption) > * > * { padding: .55rem; }
.calendar-day { width: 14.28%; height: 8.5rem; vertical-align: top; background: rgba(255, 255, 255, .3); }
.calendar-day.bg-body-secondary { background: rgba(118, 118, 128, .055) !important; }
.calendar-today { position: relative; box-shadow: inset 0 0 0 2px rgba(0, 113, 227, .72); }
.calendar-today::after { position: absolute; top: .55rem; right: .55rem; width: 6px; height: 6px; background: var(--mt-blue); border-radius: 50%; content: ""; }
.calendar-event { margin-top: .3rem; padding: .2rem .35rem; color: #075b9e; background: rgba(0, 113, 227, .1); border-left: 2px solid rgba(0, 113, 227, .55); border-radius: 5px; }
.calendar-event:hover { color: #004f91; filter: saturate(1.12); }
.calendar-event-task-upcoming { color: #545458; background: rgba(118, 118, 128, .11); border-color: rgba(118, 118, 128, .45); }
.calendar-event-task-in-progress { color: #805200; background: rgba(255, 204, 0, .16); border-color: rgba(255, 159, 10, .65); }
.calendar-event-task-overdue { color: #a20c1a; background: rgba(255, 59, 48, .12); border-color: rgba(255, 59, 48, .65); }
.calendar-event-task-completed { color: #176c2d; background: rgba(52, 199, 89, .13); border-color: rgba(52, 199, 89, .62); }
.calendar-event-payment { color: #176c2d; background: rgba(52, 199, 89, .13); border-color: rgba(52, 199, 89, .62); }
.calendar-entry-tooltip {
  --bs-tooltip-bg: rgba(28, 28, 30, .94);
  --bs-tooltip-color: #fff;
  --bs-tooltip-max-width: 280px;
  --bs-tooltip-opacity: 1;
}
.calendar-entry-tooltip .tooltip-inner {
  min-width: 190px;
  padding: .8rem .9rem;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .24);
  backdrop-filter: blur(18px) saturate(140%);
}
.calendar-entry-tooltip strong,
.calendar-entry-tooltip span { display: block; }
.calendar-tooltip-label {
  margin-bottom: .15rem;
  color: rgba(255, 255, 255, .56);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.calendar-tooltip-event-label { margin-top: .65rem; }

.auth-main { display: grid; min-height: 100vh; max-width: none; padding: 0; place-items: center; }
.auth-shell { width: min(calc(100% - 2rem), 430px); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: 1.4rem; font-size: 1.15rem; font-weight: 680; }
.auth-card { box-shadow: 0 26px 70px rgba(0, 0, 0, .1) !important; }
.auth-card .card-body { padding: 2.1rem; }

@media (max-width: 1199.98px) {
  .app-main { padding-top: 1.75rem; }
  .metric-card { min-height: 138px; }
}

@media (max-width: 991.98px) {
  .app-navbar { padding: .5rem 0; }
  .app-navbar .navbar-collapse { margin-top: .65rem; padding: .7rem; background: rgba(255, 255, 255, .06); border-radius: 14px; }
  .user-cluster { margin-top: .5rem; padding: .7rem .25rem 0; border-top: 1px solid rgba(255, 255, 255, .12); border-left: 0; }
  .nav-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .nav-tabs .nav-link { white-space: nowrap; }
}

@media (max-width: 575.98px) {
  body.app-body { font-size: 14px; }
  .app-main { padding: 1.25rem .9rem 3rem; }
  .card { border-radius: 16px; }
  .card-body { padding: 1.1rem; }
  .btn { min-height: 38px; }
  .table > :not(caption) > * > * { padding: .75rem .8rem; }
  .calendar-day { height: 6.5rem; font-size: .75rem; }
  .calendar-event { padding: .12rem .2rem; }
  .notification-menu { min-width: min(21rem, calc(100vw - 1.5rem)); }
  .auth-card .card-body { padding: 1.5rem; }
  .task-template-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
