:root {
  color-scheme: light;
  --ink: #202033;
  --muted: #85869a;
  --line: #ecebf2;
  --surface: #fff;
  --canvas: #f8f7fc;
  --purple: #6135cf;
  --purple-dark: #4e26b4;
  --purple-light: #f1edfc;
  --green: #07865a;
  --green-bg: #e8f7f0;
  --red: #c43845;
  --red-bg: #fff0f0;
  --amber: #a86b00;
  --amber-bg: #fff5df;
  --shadow: 0 12px 35px rgba(38, 29, 77, .07);
  font-family: "DM Sans", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 246px; flex-direction: column; padding: 28px 17px 16px; border-right: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 10px; width: fit-content; margin: 0 0 43px 7px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #7649e1, #5028b7); color: white; font: 800 19px "Manrope", sans-serif; box-shadow: 0 5px 12px #6135cf35; }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 16px "Manrope", sans-serif; letter-spacing: -.45px; }
.brand small { margin-top: 2px; color: #aaa7b9; font-size: 9px; font-weight: 700; letter-spacing: 1.15px; }
.sidebar-label { padding: 0 10px 11px; color: #a09eaf; font-size: 10px; font-weight: 700; letter-spacing: 1.15px; }
.navigation { display: grid; gap: 5px; }
.nav-link { display: flex; min-height: 43px; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: #69697d; cursor: pointer; text-align: left; transition: background .15s, color .15s; }
.nav-link:hover { background: #f8f6fc; color: var(--purple); }
.nav-link.active { background: var(--purple-light); color: var(--purple); font-weight: 600; }
.navigation[hidden] { display: none; }
.nav-icon { width: 19px; color: inherit; font-size: 19px; line-height: 1; text-align: center; }
.nav-section-label { margin-top: 23px; }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 15px 7px 4px; border-top: 1px solid var(--line); color: #858498; font-size: 12px; }
.environment-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #1fb77b; box-shadow: 0 0 0 3px #e4f7ef; }
.local-badge { margin-left: auto; padding: 4px 6px; border-radius: 5px; background: #f0f8f4; color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: .5px; }
.main-area { min-height: 100vh; margin-left: 246px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; height: 70px; align-items: center; justify-content: space-between; padding: 0 36px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 94%); backdrop-filter: blur(14px); }
.breadcrumb { color: #89889a; font-size: 13px; }
.breadcrumb span { padding: 0 9px; color: #c7c5d0; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.local-pill { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 20px; color: #66667a; font-size: 11px; }
.admin-profile { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid #e4ddf8; border-radius: 50%; background: var(--purple-light); color: var(--purple); font-weight: 700; }
.admin-identity strong, .admin-identity small { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity strong { font-size: 12px; font-weight: 600; }
.admin-identity small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.content-area { width: min(1440px, 100%); min-height: calc(100vh - 118px); margin: 0 auto; padding: 35px 36px 42px; }
.page-footer { display: flex; justify-content: space-between; padding: 16px 36px 19px; border-top: 1px solid var(--line); color: #9695a6; font-size: 11px; }
.page-section { animation: enter .22s ease both; }
@keyframes enter { from { opacity: .6; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 9px; color: var(--purple); font-size: 10px; font-weight: 700; letter-spacing: 1.1px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Manrope", "Segoe UI", sans-serif; }
h1 { margin-bottom: 7px; font-size: clamp(23px, 3vw, 29px); font-weight: 700; letter-spacing: -.9px; }
.page-heading > div > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #65657a; cursor: pointer; font-size: 12px; font-weight: 600; text-decoration: none; transition: transform .12s, box-shadow .12s, background .12s; }
.button:hover { box-shadow: 0 3px 10px #32235212; }
.button:active { transform: translateY(1px); }
.button-primary { border-color: var(--purple); background: var(--purple); color: #fff; box-shadow: 0 4px 11px #6135cf2b; }
.button-primary:hover { border-color: var(--purple-dark); background: var(--purple-dark); }
.button-soft { border-color: #e6def9; background: var(--purple-light); color: var(--purple); }
.button-danger { border-color: #f0d1d3; background: #fffafa; color: var(--red); }
.button-quiet { border-color: transparent; background: transparent; color: #77768a; }
.button-wide { width: 100%; min-height: 45px; }
.icon-button { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; color: #77768a; cursor: pointer; font-size: 17px; }
.icon-button:hover { border-color: #d6cbf1; color: var(--purple); }
.menu-toggle { display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 23px; }
.stat-card { position: relative; min-height: 126px; padding: 19px 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 2px 6px #2c234406; }
.stat-card::after { position: absolute; top: 17px; right: 18px; width: 33px; height: 33px; border-radius: 10px; background: var(--purple-light); color: var(--purple); content: attr(data-icon); font-size: 16px; line-height: 33px; text-align: center; }
.stat-label { display: block; margin-bottom: 14px; color: #858498; font-size: 12px; }
.stat-value { display: block; font: 700 28px "Manrope", sans-serif; letter-spacing: -.8px; }
.stat-note { display: block; margin-top: 5px; color: #9493a5; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 17px; }
.panel { border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 2px 6px #2c234406; }
.panel-header { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; border-bottom: 1px solid #f0eff4; }
.panel-header h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -.15px; }
.panel-body { padding: 17px 20px; }
.activity-list { display: grid; }
.activity-row { display: flex; align-items: flex-start; gap: 11px; padding: 13px 0; border-bottom: 1px solid #f2f1f5; }
.activity-row:last-child { border: 0; }
.activity-mark { display: grid; width: 29px; height: 29px; flex: 0 0 auto; place-items: center; border-radius: 9px; background: #f1edfc; color: var(--purple); font-size: 12px; }
.activity-copy { min-width: 0; flex: 1; }
.activity-copy strong { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 600; }
.activity-copy small { display: block; color: #8e8d9f; font-size: 10px; }
.activity-time { flex: 0 0 auto; color: #a09eaf; font-size: 10px; }
.empty-action { margin-top: 15px; }
.info-panel { margin-bottom: 14px; }
.info-copy { font-size: 11px; line-height: 1.65; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 14px; }
.search-box { position: relative; display: flex; min-width: 200px; flex: 1 1 225px; align-items: center; }
.search-box span { position: absolute; left: 12px; color: #a09eaf; font-size: 17px; }
.field-control, .search-box input, .form-stack input, .form-stack select, .form-stack textarea { min-height: 39px; width: 100%; padding: 0 11px; border: 1px solid #e7e5ed; border-radius: 7px; outline: 0; background: #fff; color: #38374d; font-size: 12px; }
.search-box input { padding-left: 35px; }
.field-control:focus, .search-box input:focus, .form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus { border-color: #9e83e5; box-shadow: 0 0 0 3px #6135cf17; }
.filter-select { width: auto; min-width: 140px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: white; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { height: 42px; padding: 0 15px; border-bottom: 1px solid var(--line); background: #fbfafe; color: #8a899a; font-size: 10px; font-weight: 600; letter-spacing: .35px; white-space: nowrap; }
.data-table td { height: 61px; padding: 9px 15px; border-bottom: 1px solid #f0eff4; color: #666579; font-size: 11px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fcfbfe; }
.cell-primary { display: block; max-width: 250px; overflow: hidden; color: #343349; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cell-secondary { display: block; max-width: 240px; margin-top: 4px; overflow: hidden; color: #9695a5; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; background: #f1f0f5; color: #666579; font-size: 10px; font-weight: 600; white-space: nowrap; }
.status-badge::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-active, .status-trial { background: var(--green-bg); color: var(--green); }
.status-overdue, .status-blocked, .status-suspended { background: var(--amber-bg); color: var(--amber); }
.status-canceled { background: var(--red-bg); color: var(--red); }
.table-actions { display: flex; align-items: center; gap: 5px; }
.table-actions { flex-wrap: wrap; }
.table-actions a { white-space: nowrap; }
.table-action { display: inline-flex; min-height: 29px; align-items: center; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--purple); cursor: pointer; font-size: 10px; font-weight: 600; }
.table-action:hover { border-color: #e6def9; background: #f7f4fd; }
.table-action.danger { color: var(--red); }
.table-action:disabled { color: #aaa8b8; cursor: not-allowed; }
.table-footer { display: flex; justify-content: space-between; padding: 12px 2px 0; color: #8d8c9d; font-size: 11px; }
.empty-state { padding: 38px 20px; color: #858498; text-align: center; }
.empty-state strong { display: block; margin-bottom: 7px; color: #4a495e; font-size: 13px; }
.empty-state p { margin: 0; font-size: 11px; line-height: 1.6; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.plan-card { padding: 19px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.plan-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan-card h2 { margin: 0; font-size: 15px; }
.plan-price { margin: 17px 0 4px; font: 700 26px "Manrope", sans-serif; letter-spacing: -.7px; }
.plan-cycle { color: #8d8c9d; font-size: 11px; }
.plan-description { min-height: 34px; margin: 14px 0; color: #77768a; font-size: 11px; line-height: 1.55; }
.plan-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 13px; border-top: 1px solid var(--line); color: #8a899a; font-size: 10px; }
.detail-link { border: 0; background: transparent; color: var(--purple); cursor: pointer; font-size: 11px; font-weight: 600; }
.form-stack { display: grid; gap: 14px; }
.form-stack label { display: grid; gap: 6px; color: #56556a; font-size: 11px; font-weight: 600; }
.form-stack input, .form-stack select, .form-stack textarea { min-height: 41px; font-size: 12px; font-weight: 400; }
.form-stack textarea { min-height: 80px; padding: 10px 11px; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-hint { margin: -7px 0 0; color: #9190a1; font-size: 10px; line-height: 1.55; }
.form-error { margin: 0; color: var(--red); font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 18px; }
.detail-grid > div { min-width: 0; }
.detail-grid span, .detail-notes > span { display: block; margin-bottom: 4px; color: #9291a2; font-size: 10px; }
.detail-grid strong { display: block; overflow-wrap: anywhere; color: #424156; font-size: 11px; font-weight: 600; }
.detail-notes { margin-top: 17px; padding: 12px; border-radius: 8px; background: #faf9fc; }
.detail-notes p { margin: 0; color: #626176; font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.detail-users-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.detail-users-header strong { font-size: 12px; }
.detail-users { display: grid; }
.detail-user { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid #f1f0f4; }
.detail-user .avatar { width: 29px; height: 29px; font-size: 10px; }
.detail-user > span:nth-child(2) { min-width: 0; flex: 1; }
.detail-user strong, .detail-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-user strong { color: #49485c; font-size: 11px; }
.detail-user small { margin-top: 3px; color: #8b899a; font-size: 10px; }
.detail-empty { margin: 10px 0 0; font-size: 11px; }
.checkbox-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
.checkbox-list label { display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 500; }
.checkbox-list input { width: 14px; min-height: 14px; height: 14px; accent-color: var(--purple); }
.modal { width: min(570px, calc(100vw - 28px)); max-height: min(85vh, 760px); padding: 0; overflow: auto; border: 1px solid #e8e6ef; border-radius: 14px; background: white; box-shadow: 0 24px 80px #19133335; }
.modal::backdrop { background: rgb(32 29 48 / 48%); backdrop-filter: blur(3px); }
.modal-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 19px 22px; border-bottom: 1px solid var(--line); background: white; }
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-form { padding: 20px 22px 23px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 5px; }
.auth-screen { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: radial-gradient(ellipse at 50% 0%, #eee9fb 0, transparent 46%), var(--canvas); }
.auth-card { width: min(420px, 100%); padding: 31px; border: 1px solid #eeeaf4; border-radius: 16px; background: white; box-shadow: 0 20px 60px #2d205013; }
.auth-brand { margin: 0 0 35px; }
.auth-card h1 { font-size: 25px; }
.auth-card > .muted { margin-bottom: 25px; font-size: 12px; line-height: 1.6; }
.auth-security { margin: 21px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: #9a98a9; font-size: 10px; text-align: center; }
.auth-switch { display: block; margin: 16px auto 0; padding: 5px; border: 0; background: none; color: var(--purple); cursor: pointer; font-size: 11px; font-weight: 600; }
.auth-switch:hover { text-decoration: underline; }
.portal-company-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, .8fr); gap: 15px; }
.detail-grid .copy-button { margin-top: 5px; }
.trial-notice { margin-bottom: 16px; padding: 13px 15px; border: 1px solid #f0e0bc; border-radius: 9px; background: #fffaf0; color: #805d1a; font-size: 11px; line-height: 1.6; }
.detail-link:disabled { color: #aaa8b8; cursor: not-allowed; }
.auth-card input { min-height: 44px; }
.address-fieldset { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 9px; }
.address-fieldset legend { padding: 0 5px; color: #77768a; font-size: 10px; font-weight: 600; }
.service-options-fieldset { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 9px; }
.service-options-fieldset legend { padding: 0 5px; color: #77768a; font-size: 10px; font-weight: 600; }
.service-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service-option-group { display: grid; align-content: start; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.service-option-group > strong { color: #77768a; font-size: 10px; }
.service-option { display: flex; align-items: center; gap: 7px; color: #38374d; font-size: 11px; }
.service-option input { width: 14px; min-height: 14px; height: 14px; accent-color: var(--purple); }
.company-summary { margin-bottom: 16px; }
.company-summary .panel-body { display: grid; }
.company-settings-form { max-width: 820px; margin: 0 auto; }
.info-copy { font-size: 11px; line-height: 1.65; }
.status-expired { background: var(--red-bg); color: var(--red); }
.status-suspended { background: var(--amber-bg); color: var(--amber); }
.checkbox-list + .form-hint { margin-top: -3px; }
.toast-region { position: fixed; top: 84px; right: 24px; z-index: 50; display: grid; width: min(370px, calc(100vw - 35px)); gap: 8px; }
.toast { padding: 13px 15px; border: 1px solid #d9ecdf; border-radius: 9px; background: #f4fbf6; color: #24734d; box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; animation: enter .18s ease both; }
.toast.error { border-color: #f0d6d8; background: #fff7f7; color: #ad3540; }
.toast-region .toast + .toast { margin-top: 0; }
.sidebar-overlay { display: none; }
.loading { padding: 30px 10px; color: #89889a; font-size: 12px; text-align: center; }

@media (max-width: 1100px) {
  .sidebar { width: 215px; }
  .main-area { margin-left: 215px; }
  .topbar { padding-right: 24px; padding-left: 24px; }
  .content-area { padding-right: 24px; padding-left: 24px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .portal-company-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { z-index: 40; width: 260px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 40px #20173315; }
  .sidebar.open { transform: none; }
  .sidebar-overlay.open { position: fixed; inset: 0; z-index: 30; display: block; background: #20173355; }
  .main-area { margin-left: 0; }
  .topbar { height: 61px; gap: 10px; padding: 0 15px; }
  .menu-toggle { display: grid; }
  .breadcrumb { flex: 1; font-size: 11px; }
  .topbar-actions { gap: 10px; }
  .local-pill, .admin-identity, .button-logout { display: none; }
  .content-area { min-height: calc(100vh - 104px); padding: 24px 15px 30px; }
  .page-heading { align-items: center; margin-bottom: 19px; }
  .page-heading .button { min-height: 35px; padding: 0 10px; font-size: 10px; }
  .page-heading h1 { font-size: 22px; }
  .page-heading > div > p:last-child { max-width: 300px; font-size: 11px; line-height: 1.5; }
  .stats-grid { gap: 9px; }
  .stat-card { min-height: 107px; padding: 15px; }
  .stat-card::after { top: 12px; right: 12px; width: 28px; height: 28px; line-height: 28px; }
  .stat-label { max-width: 110px; margin-bottom: 12px; font-size: 10px; }
  .stat-value { font-size: 23px; }
  .toolbar { gap: 7px; }
  .search-box { flex-basis: 100%; }
  .filter-select { min-width: 0; flex: 1 1 130px; }
  .table-wrap { margin-right: -1px; }
  .data-table th, .data-table td { padding-right: 11px; padding-left: 11px; }
  .page-footer { padding: 13px 15px; font-size: 9px; }
}
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card::after { display: none; }
  .form-row, .service-options { grid-template-columns: 1fr; }
  .modal-form { padding: 16px; }
  .modal-header { padding: 16px; }
  .auth-card { padding: 24px 20px; }
  .panel-header, .panel-body { padding-right: 14px; padding-left: 14px; }
}
