/* Mystate by Negecace — workspace & admin styles (built on Bootstrap 5.3) */
:root {
  --ms-primary: #0F4C5C;
  --ms-primary-700: #0A3742;
  --ms-accent: #E36414;
  --ms-accent-soft: #FCE9DC;
  --ms-sand: #F6F3EE;
  --ms-card: #FFFFFF;
  --ms-ink: #1B2430;
  --ms-muted: #6B7280;
  --ms-line: #E7E2D9;
  --ms-sidebar-w: 252px;
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-bg: var(--ms-sand);
  --bs-body-color: var(--ms-ink);
  --bs-primary: #0F4C5C;
  --bs-primary-rgb: 15, 76, 92;
  --bs-link-color: #0F4C5C;
  --bs-link-color-rgb: 15, 76, 92;
  --bs-link-hover-color: #E36414;
  --bs-border-color: var(--ms-line);
  --bs-border-radius: .6rem;
}
[data-bs-theme="dark"] {
  --ms-sand: #11161C;
  --ms-card: #182028;
  --ms-ink: #E6EAEE;
  --ms-muted: #9AA4AF;
  --ms-line: #26313C;
  --ms-accent-soft: #3A2416;
  --bs-body-bg: #11161C;
  --bs-body-color: #E6EAEE;
  --bs-border-color: #26313C;
  --bs-primary: #3FA7BE;
  --bs-primary-rgb: 63, 167, 190;
  --bs-link-color: #7FD0E2;
  --bs-link-color-rgb: 127, 208, 226;
  --bs-secondary-bg: #1E2832;
  --bs-tertiary-bg: #1A232C;
}
body { background: var(--ms-sand); color: var(--ms-ink); font-size: .935rem; }
h1, h2, h3, h4, h5 { letter-spacing: -.01em; font-weight: 700; }
.text-muted, .form-text { color: var(--ms-muted) !important; }
.btn-primary { --bs-btn-bg: var(--ms-primary); --bs-btn-border-color: var(--ms-primary); --bs-btn-hover-bg: var(--ms-primary-700); --bs-btn-hover-border-color: var(--ms-primary-700); --bs-btn-active-bg: var(--ms-primary-700); --bs-btn-disabled-bg: var(--ms-primary); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #1C7389; --bs-btn-border-color: #1C7389; --bs-btn-hover-bg: #23849C; }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--ms-accent); --bs-btn-border-color: var(--ms-accent); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #C9550F; --bs-btn-hover-border-color: #C9550F; --bs-btn-active-bg: #B44C0E; --bs-btn-active-color:#fff; }
.btn-outline-primary { --bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary); --bs-btn-active-bg: var(--bs-primary); }
.text-bg-primary { background-color: var(--ms-primary) !important; }
.form-control, .form-select { border-color: var(--ms-line); }
.form-control:focus, .form-select:focus { border-color: var(--ms-accent); box-shadow: 0 0 0 .2rem rgba(227, 100, 20, .15); }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }

/* ---- Shell ---- */
.ms-shell { display: flex; min-height: 100vh; }
.ms-sidebar { width: var(--ms-sidebar-w); flex-shrink: 0; background: var(--ms-primary); color: #D7E6EA; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
[data-bs-theme="dark"] .ms-sidebar { background: #0B1217; border-right: 1px solid var(--ms-line); }
.ms-brand { display: flex; align-items: center; gap: .6rem; padding: 1.15rem 1.25rem; color: #fff; text-decoration: none; }
.ms-brand:hover { color: #fff; }
.ms-brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--ms-accent); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 1.05rem; flex-shrink: 0; overflow: hidden; }
.ms-brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.ms-brand-name { font-weight: 800; font-size: 1.1rem; line-height: 1.1; }
.ms-brand-sub { font-size: .7rem; opacity: .7; font-weight: 500; }
.ms-nav { padding: .25rem .75rem 1rem; }
.ms-nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; opacity: .55; padding: .9rem .6rem .35rem; font-weight: 700; }
.ms-nav a { display: flex; align-items: center; gap: .7rem; color: #D7E6EA; text-decoration: none; padding: .5rem .65rem; border-radius: .5rem; font-weight: 500; font-size: .9rem; }
.ms-nav a i { font-size: 1.05rem; opacity: .85; width: 1.2rem; text-align: center; }
.ms-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.ms-nav a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--ms-accent); }
.ms-nav a .badge { margin-left: auto; }
.ms-sidebar-foot { margin-top: auto; padding: 1rem 1.25rem; font-size: .75rem; opacity: .6; }
.ms-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ms-topbar { height: 64px; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; background: var(--ms-card); border-bottom: 1px solid var(--ms-line); position: sticky; top: 0; z-index: 1020; }
.ms-topbar .form-control { max-width: 340px; background: var(--ms-sand); border: 0; }
.ms-content { padding: 1.6rem 1.5rem 3rem; max-width: 1480px; width: 100%; }
.ms-icon-btn { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--ms-ink); position: relative; }
.ms-icon-btn:hover { background: var(--ms-sand); }
.ms-dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--ms-accent); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; }
@media (max-width: 991.98px) {
  .ms-sidebar { position: fixed; left: 0; top: 0; z-index: 1045; transform: translateX(-100%); transition: transform .2s ease; }
  .ms-sidebar.show { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .ms-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1040; display: none; }
  .ms-backdrop.show { display: block; }
  .ms-content { padding: 1.1rem 1rem 3rem; }
  .ms-topbar { padding: 0 1rem; }
}

/* ---- Page header ---- */
.ms-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.ms-page-head h1 { font-size: 1.55rem; margin: 0; }
.ms-page-head .crumbs { font-size: .8rem; color: var(--ms-muted); margin-bottom: .2rem; }
.ms-page-head .crumbs a { color: var(--ms-muted); text-decoration: none; }

/* ---- Cards ---- */
.card { --bs-card-bg: var(--ms-card); --bs-card-border-color: var(--ms-line); border-radius: .85rem; }
.card-header { background: transparent; border-bottom-color: var(--ms-line); font-weight: 700; padding: .9rem 1.1rem; }
.ms-kpi { padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: center; height: 100%; }
.ms-kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.ms-kpi-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.ms-kpi-label { font-size: .8rem; color: var(--ms-muted); font-weight: 500; }
.tint-teal { background: #E2F0F2; color: #0F4C5C; } .tint-orange { background: var(--ms-accent-soft); color: #C2540F; }
.tint-green { background: #E3F5EC; color: #13804D; } .tint-violet { background: #EEE9FB; color: #5B3CC4; }
.tint-blue { background: #E4EEFD; color: #2459C9; } .tint-rose { background: #FCE7EC; color: #BE2B4E; }
[data-bs-theme="dark"] .tint-teal, [data-bs-theme="dark"] .tint-orange, [data-bs-theme="dark"] .tint-green,
[data-bs-theme="dark"] .tint-violet, [data-bs-theme="dark"] .tint-blue, [data-bs-theme="dark"] .tint-rose { background: rgba(255,255,255,.07); }

/* ---- Tables ---- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .9rem; border-bottom-color: var(--ms-line); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ms-muted); font-weight: 700; background: transparent; white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(15, 76, 92, .035); }
.ms-thumb { width: 64px; height: 46px; border-radius: .45rem; object-fit: cover; background: var(--ms-sand); }
.avatar-initials { display: inline-grid; place-items: center; border-radius: 50%; background: #DCEAEC; color: var(--ms-primary); font-weight: 700; flex-shrink: 0; }
[data-bs-theme="dark"] .avatar-initials { background: #22313B; color: #9ED6E3; }

/* ---- Filters ---- */
.ms-filters { background: var(--ms-card); border: 1px solid var(--ms-line); border-radius: .85rem; padding: .85rem; margin-bottom: 1rem; }

/* ---- Kanban ---- */
.ms-kanban { display: flex; gap: .9rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.ms-col { flex: 0 0 290px; background: rgba(15,76,92,.045); border-radius: .85rem; padding: .7rem; max-height: calc(100vh - 210px); display: flex; flex-direction: column; }
[data-bs-theme="dark"] .ms-col { background: rgba(255,255,255,.035); }
.ms-col-head { display: flex; align-items: center; gap: .5rem; padding: .2rem .3rem .65rem; font-weight: 700; font-size: .88rem; }
.ms-col-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.ms-col-body { overflow-y: auto; min-height: 80px; flex: 1; display: flex; flex-direction: column; gap: .55rem; }
.ms-card-lead { background: var(--ms-card); border: 1px solid var(--ms-line); border-radius: .7rem; padding: .7rem .8rem; cursor: grab; font-size: .82rem; }
.ms-card-lead:hover { border-color: var(--ms-accent); }
.ms-card-lead .name { font-weight: 700; font-size: .9rem; color: var(--ms-ink); text-decoration: none; }
.ms-card-lead .meta { color: var(--ms-muted); display: flex; align-items: center; gap: .35rem; margin-top: .2rem; }
.sortable-ghost { opacity: .4; }

/* ---- Calendar ---- */
.ms-cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--ms-line); border-left: 1px solid var(--ms-line); }
.ms-cal .dow { font-size: .72rem; text-transform: uppercase; font-weight: 700; color: var(--ms-muted); padding: .45rem; border-right: 1px solid var(--ms-line); border-bottom: 1px solid var(--ms-line); background: var(--ms-sand); }
.ms-cal .day { min-height: 108px; padding: .35rem; border-right: 1px solid var(--ms-line); border-bottom: 1px solid var(--ms-line); font-size: .75rem; }
.ms-cal .day.other { background: rgba(0,0,0,.02); color: var(--ms-muted); }
.ms-cal .day.today .num { background: var(--ms-accent); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-grid; place-items: center; }
.ms-cal .ev { display: block; background: #E2F0F2; color: #0A3742; border-radius: .3rem; padding: 1px 5px; margin-top: 3px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-cal .ev.cancelled { text-decoration: line-through; opacity: .6; }
[data-bs-theme="dark"] .ms-cal .ev { background: #1F3640; color: #CBE7EE; }
@media (max-width: 767.98px) { .ms-cal .day { min-height: 64px; } .ms-cal .ev { font-size: .62rem; } }

/* ---- Timeline ---- */
.ms-timeline { list-style: none; padding: 0; margin: 0; }
.ms-timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.ms-timeline li::before { content: ""; position: absolute; left: .42rem; top: .4rem; bottom: -.3rem; width: 2px; background: var(--ms-line); }
.ms-timeline li:last-child::before { display: none; }
.ms-timeline .tl-dot { position: absolute; left: 0; top: .2rem; width: 16px; height: 16px; border-radius: 50%; background: var(--ms-card); border: 3px solid var(--ms-primary); }
.ms-timeline .tl-dot.system { border-color: var(--ms-muted); } .ms-timeline .tl-dot.stage_change { border-color: var(--ms-accent); }

/* ---- Gallery manager ---- */
.ms-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.ms-gallery .item { position: relative; border-radius: .6rem; overflow: hidden; border: 2px solid transparent; cursor: grab; background: var(--ms-sand); }
.ms-gallery .item.cover { border-color: var(--ms-accent); }
.ms-gallery img { width: 100%; height: 110px; object-fit: cover; display: block; }
.ms-gallery .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: .3rem; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.ms-gallery .tools .btn { --bs-btn-padding-y: .1rem; --bs-btn-padding-x: .4rem; --bs-btn-font-size: .72rem; }

/* ---- Checklist ---- */
.ms-check { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px dashed var(--ms-line); text-decoration: none; color: var(--ms-ink); }
.ms-check:last-child { border-bottom: 0; }
.ms-check .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--ms-line); flex-shrink: 0; font-size: .85rem; }
.ms-check.done .ic { background: #13804D; border-color: #13804D; color: #fff; }
.ms-check.done .lbl { text-decoration: line-through; color: var(--ms-muted); }
.ms-progress { height: 8px; border-radius: 9px; background: var(--ms-line); overflow: hidden; }
.ms-progress > div { height: 100%; background: linear-gradient(90deg, var(--ms-primary), var(--ms-accent)); }

/* ---- Auth pages ---- */
.ms-auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.ms-auth-art { background: linear-gradient(160deg, rgba(10,55,66,.92), rgba(15,76,92,.78)), url('../img/auth-bg.svg') center/cover; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.ms-auth-art h2 { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 2.4rem; line-height: 1.15; max-width: 30rem; }
.ms-auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.ms-auth-box { width: 100%; max-width: 440px; }
.ms-auth-box.wide { max-width: 760px; }
@media (max-width: 991.98px) { .ms-auth { grid-template-columns: 1fr; } .ms-auth-art { display: none; } }

/* ---- Utilities ---- */
.fw-800 { font-weight: 800; }
.small-caps { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ms-muted); font-weight: 700; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ms-muted); }
.empty-state i { font-size: 2.6rem; color: var(--ms-line); display: block; margin-bottom: .5rem; }
.color-swatch { width: 44px; height: 38px; padding: 3px; }
.cursor-grab { cursor: grab; }
.dropdown-menu { --bs-dropdown-bg: var(--ms-card); --bs-dropdown-border-color: var(--ms-line); border-radius: .7rem; box-shadow: 0 12px 32px rgba(15,30,40,.12); }
.notif-item { white-space: normal; font-size: .82rem; border-bottom: 1px solid var(--ms-line); }
.notif-item.unread { background: var(--ms-accent-soft); }
.list-group { --bs-list-group-bg: var(--ms-card); --bs-list-group-border-color: var(--ms-line); }
.nav-tabs { --bs-nav-tabs-link-active-bg: var(--ms-card); --bs-nav-tabs-link-active-border-color: var(--ms-line) var(--ms-line) var(--ms-card); }
.modal { --bs-modal-bg: var(--ms-card); }
.ms-section-sort li { cursor: grab; }
.object-fit-cover { object-fit: cover; }
@media print { .ms-sidebar, .ms-topbar, .btn { display: none !important; } }
