:root {
      color-scheme: light;
      --bg: #f5f6f8;
      --panel: #ffffff;
      --text: #1f2933;
      --muted: #6b7a89;
      --accent: #1b6ef3;
      --border: #e3e7ee;
    }
    html, body {
      margin: 0;
      padding: 0;
    }
    body {
      font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
      background: var(--bg);
      color: var(--text);
    }
    .header-1 {
      font-size: 24px;
      line-height: 1.2;
      font-weight: 700;
    }
    .header-2 {
      font-size: 18px;
      line-height: 1.3;
      font-weight: 600;
    }
    .header-3 {
      font-size: 16px;
      line-height: 1.3;
      font-weight: 600;
    }
    .text-1 {
      font-size: 14px;
      line-height: 1.5;
    }
    .text-2 {
      font-size: 13px;
      line-height: 1.5;
    }
    .text-3 {
      font-size: 12px;
      line-height: 1.4;
    }
    body.nav-open {
      overflow: hidden;
    }
    header {
      background: var(--panel);
      border-bottom: 1px solid var(--border);
      margin: 0;
      padding: 12px 24px;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      gap: 16px;
      position: sticky;
      top: 0;
      z-index: 10000;
    }
    header a {
      color: var(--text);
      text-decoration: none;
      margin-right: 16px;
    }
    .sync-banner {
      padding: 6px 12px;
      background: #fff3cd;
      border: 1px solid #ffe3a3;
      color: #7a4b00;
      border-radius: 10px;
      font-size: 12px;
      text-align: center;
      white-space: nowrap;
    }
    .header-left {
      justify-self: start;
    }
    .header-center {
      justify-self: center;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .header-right {
      display: flex;
      align-items: center;
      gap: 16px;
      flex-wrap: wrap;
      justify-content: flex-end;
      justify-self: end;
    }
    .rates {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: var(--panel);
      font-size: 13px;
      overflow: visible;
      width: fit-content;
      max-width: 100%;
    }
    .rate {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .rate-code {
      font-weight: 600;
      color: var(--text);
    }
    .rate-value {
      font-weight: 700;
      color: var(--text);
      min-width: 52px;
    }
    .rates-actions {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .rates-manual {
      position: absolute;
      top: calc(100% + 10px);
      right: 0;
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px;
      box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
      width: 320px;
      max-width: 90vw;
      z-index: 30;
      box-sizing: border-box;
    }
    .rates-manual form {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .rates-manual label {
      font-size: 12px;
    }
    .rates-manual input,
    .rates-manual select {
      width: 100%;
      box-sizing: border-box;
    }
    .rates-manual-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }
    .rates-meta {
      margin-top: 8px;
      color: var(--muted);
    }
    main {
      max-width: 1600px;
      margin: 0 auto;
      padding: 24px;
    }
    .panel {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 20px;
      box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    }
    .btn {
      background: var(--accent);
      color: #fff;
      border: none;
      padding: 10px 16px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 600;
      box-sizing: border-box;
      max-width: 100%;
    }
    .btn.secondary {
      background: #e3e7ee;
      color: var(--text);
    }
    .btn.small {
      padding: 6px 10px;
      font-size: 12px;
      border-radius: 6px;
    }
    .btn-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }
    .btn-icon img {
      width: 16px;
      height: 16px;
      display: block;
    }
    .btn-icon.is-loading img {
      animation: spin 0.9s linear infinite;
      opacity: 0.8;
    }
    .btn:disabled {
      opacity: 0.7;
      cursor: not-allowed;
    }
    label {
      display: block;
      font-size: 14px;
      color: var(--muted);
    }
    input[type="date"],
    input[type="datetime-local"],
    input[type="number"],
    input[type="search"],
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select {
      margin-top: 6px;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 14px;
      background: #fff;
      box-sizing: border-box;
      max-width: 100%;
    }
    .form-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-bottom: 12px;
    }
    .muted {
      color: var(--muted);
    }
    table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 12px;
      font-size: 14px;
    }
    th, td {
      padding: 10px 12px;
      border-bottom: 1px solid var(--border);
      text-align: left;
      vertical-align: top;
    }
    th {
      background: #f0f3f8;
      font-weight: 600;
    }
    .report-table th {
      background: #dfead3;
      color: #1f2933;
    }
    .report-meta {
      margin-bottom: 8px;
    }
    .filter-row {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: center;
      margin-top: 12px;
    }
    .filter-left,
    .filter-right {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: center;
    }
    .filter-right {
      margin-left: auto;
    }
    .filter-search {
      margin-left: 20px;
    }
    .pagination {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: center;
      margin-top: 12px;
    }
    .pagination-info {
      font-size: 13px;
      color: var(--muted);
    }
    .pagination-links {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .pagination .btn[aria-disabled="true"] {
      opacity: 0.6;
      cursor: not-allowed;
      pointer-events: none;
    }
    .filter-row .export-btn {
      margin-left: auto;
    }
    .checkbox {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 14px;
      color: var(--text);
    }
    .report-cards {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 16px;
      margin-top: 16px;
    }
    .report-cards.stacked {
      grid-template-columns: 1fr;
    }
    .report-card {
      display: block;
      padding: 18px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: var(--panel);
      text-decoration: none;
      color: var(--text);
      box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    .report-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    }
    .report-card-title {
      font-weight: 700;
      font-size: 16px;
      margin-bottom: 6px;
    }
    .report-card-desc {
      color: var(--muted);
      font-size: 13px;
    }
    .messages {
      margin: 0 0 16px;
      padding: 0;
      list-style: none;
    }
    .messages li {
      padding: 10px 12px;
      border-radius: 8px;
      margin-bottom: 8px;
    }
    .messages li.success {
      background: #e6f4ea;
      color: #1e6f3f;
    }
    .messages li.error {
      background: #fdecea;
      color: #b42318;
    }
    .form-error,
    .errorlist {
      margin: 6px 0 0;
      padding: 0;
      list-style: none;
      font-size: 12px;
      color: #b42318;
    }
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 16px;
      margin: 16px 0 20px;
    }
    .stat-card {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 18px 16px 16px;
      background: #f9fafc;
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-height: 86px;
      justify-content: center;
      position: relative;
    }
    .stat-label {
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
    }
    .stat-value {
      font-size: 28px;
      font-weight: 700;
      color: var(--text);
    }
    .stat-count {
      position: absolute;
      top: 12px;
      right: 12px;
      font-size: 12px;
      color: var(--muted);
    }
    .actions-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 16px;
      margin-top: 16px;
    }
    @media (max-width: 900px) {
      .stats-grid,
      .actions-grid {
        grid-template-columns: 1fr;
      }
    }
    .action-card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
      display: flex;
      flex-direction: column;
      gap: 12px;
      position: relative;
    }
    .action-title {
      font-weight: 600;
      color: var(--text);
      text-decoration: none;
    }
    .action-title:hover {
      color: var(--accent);
    }
    .action-count {
      position: absolute;
      top: 12px;
      right: 12px;
      font-size: 12px;
      color: var(--muted);
      text-align: right;
      white-space: nowrap;
    }
    .action-count .count-number {
      font-weight: 700;
      color: var(--text);
    }
    .action-count.secondary {
      top: 30px;
    }
    .action-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
      color: var(--text);
    }
    .action-table th,
    .action-table td {
      padding: 6px;
      border-bottom: 1px solid var(--border);
      text-align: left;
      vertical-align: top;
    }
    .action-table td {
      word-break: break-word;
    }
    .action-table th {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      color: var(--muted);
      font-weight: 600;
    }
    .action-table tr:last-child td {
      border-bottom: none;
    }
    .action-table-empty {
      color: var(--muted);
      font-size: 12px;
    }
    .action-divider {
      height: 1px;
      background: var(--border);
      margin: 6px 0;
    }
    .action-item-title {
      font-weight: 600;
    }
    .action-item-sub {
      color: var(--muted);
      font-size: 12px;
    }
    .action-form {
      margin-top: auto;
    }
    .loader-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.35);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 9999;
    }
    .loader-backdrop.active {
      display: flex;
    }
    .loader-card {
      background: #fff;
      border-radius: 12px;
      padding: 16px 20px;
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 600;
      box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
    }
    .loader-spinner {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      border: 3px solid #dbe2ef;
      border-top-color: var(--accent);
      animation: spin 0.9s linear infinite;
    }
    .logo-link {
      display: inline-flex;
      align-items: center;
      text-decoration: none;
    }
    .logo-link img {
      height: 56px;
      width: auto;
      display: block;
    }
    .nav-logout {
      display: inline;
      margin: 0;
    }
    .nav-logout button {
      background: none;
      border: none;
      color: var(--text);
      cursor: pointer;
      font: inherit;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
    }
    .nav-logout button img {
      width: 14px;
      height: 14px;
      display: block;
    }
    .nav-logout button:hover {
      color: var(--accent);
    }
    .nav-user-block {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .nav-user {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
      color: var(--text);
      font-size: 13px;
      white-space: nowrap;
    }
    .nav-user-icon {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: #e3e7ee;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
    }
    .nav-user-icon img {
      width: 16px;
      height: 16px;
      display: block;
      opacity: 0.7;
    }
    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
    .nav-toggle {
      display: none;
      align-items: center;
      gap: 6px;
      background: #e3e7ee;
      border: 1px solid var(--border);
      color: var(--text);
      padding: 8px;
      border-radius: 10px;
      cursor: pointer;
      font-weight: 600;
      min-width: 40px;
      min-height: 40px;
      justify-content: center;
    }
    .nav-toggle .burger {
      display: inline-block;
      width: 16px;
      height: 12px;
      position: relative;
    }
    .nav-toggle .burger span {
      position: absolute;
      left: 0;
      right: 0;
      height: 2px;
      background: var(--text);
      border-radius: 999px;
      transition: transform 0.2s ease, opacity 0.2s ease;
    }
    .nav-toggle .burger span:nth-child(1) {
      top: 0;
    }
    .nav-toggle .burger span:nth-child(2) {
      top: 5px;
    }
    .nav-toggle .burger span:nth-child(3) {
      bottom: 0;
    }
    .nav-close {
      display: none;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: #f0f3f8;
      cursor: pointer;
      position: absolute;
      top: 12px;
      right: 16px;
    }
    .nav-close img {
      width: 16px;
      height: 16px;
      display: block;
    }
    .primary-nav {
      display: flex;
      align-items: center;
      gap: 16px;
    }
    .nav-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(15, 23, 42, 0.45);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
      z-index: 9000;
    }
    .nav-backdrop.active {
      opacity: 1;
      pointer-events: auto;
    }
    .login-shell {
      min-height: calc(100vh - 48px);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
      box-sizing: border-box;
    }
    .login-panel {
      width: min(420px, 100%);
      text-align: center;
    }
    .login-panel h1 {
      margin-top: 0;
    }
    .login-panel form {
      display: flex;
      flex-direction: column;
      gap: 12px;
      align-items: center;
    }
    .login-panel form p {
      width: 100%;
      margin: 0;
      text-align: left;
    }
    .login-panel input {
      width: 100%;
      box-sizing: border-box;
    }
    .login-panel .btn {
      width: 100%;
      margin-top: 16px;
    }
    @media (max-width: 1100px) {
      header {
        grid-template-columns: 1fr;
        padding: 12px 16px;
        gap: 12px;
      }
      .header-left,
      .header-center,
      .header-right {
        justify-self: stretch;
      }
      .header-left {
        display: flex;
        justify-content: center;
      }
      .header-right nav {
        justify-content: center;
        gap: 10px;
      }
      header a {
        margin-right: 0;
      }
      .rates {
        justify-content: center;
        flex-wrap: wrap;
      }
    }
    @media (max-width: 768px) {
      main {
        margin: 0 auto;
        padding: 16px;
      }
      .panel {
        padding: 16px;
      }
      .form-row,
      .filter-row {
        flex-direction: column;
        align-items: stretch;
      }
      .form-row > *,
      .filter-row > * {
        width: 100%;
      }
      .filter-left,
      .filter-right {
        width: 100%;
      }
      .filter-right {
        margin-left: 0;
      }
      .filter-search {
        margin-left: 0;
      }
      .filter-row .export-btn {
        margin-left: 0;
      }
      input[type="date"],
      input[type="datetime-local"],
      input[type="number"],
      select {
        width: 100%;
      }
      .rates-actions {
        width: 100%;
        justify-content: center;
      }
      .action-count {
        position: static;
        text-align: left;
      }
      .action-count.secondary {
        top: auto;
      }
      .action-card,
      .panel {
        overflow-x: auto;
      }
      table {
        font-size: 12px;
      }
      th, td {
        padding: 8px 10px;
      }
    }
    @media (max-width: 900px) {
      header {
        grid-template-columns: 1fr auto;
        grid-template-areas:
          "left right"
          "center center";
      }
      .header-left {
        justify-self: start;
        justify-content: flex-start;
        grid-area: left;
      }
      .header-right {
        justify-self: end;
        align-items: center;
        grid-area: right;
      }
      .header-center {
        grid-area: center;
        justify-self: stretch;
      }
      .header-right {
        flex-direction: column;
        align-items: flex-end;
      }
      .nav-toggle {
        display: inline-flex;
        justify-content: center;
        width: auto;
      }
      .primary-nav {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: max-content;
        max-width: min(90vw, 420px);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 12px;
        background: var(--panel);
        border-left: 1px solid var(--border);
        border-radius: 16px 0 0 16px;
        padding: 48px 18px 20px 24px;
        box-shadow: -12px 0 24px rgba(15, 23, 42, 0.2);
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 11000;
        overflow-y: auto;
      }
      .header-right .primary-nav {
        justify-content: flex-start;
      }
      .nav-close {
        display: inline-flex;
      }
      .primary-nav.open {
        transform: translateX(0);
      }
      .primary-nav a,
      .primary-nav .nav-logout,
      .primary-nav .nav-user,
      .primary-nav .nav-user-block {
        padding: 6px 0 6px 4px;
      }
      .primary-nav .nav-logout button {
        text-align: left;
      }
    }
    @media (max-width: 480px) {
      header {
        padding: 10px 12px;
      }
      .logo-link {
        font-size: 15px;
      }
      .logo-link img {
        height: 44px;
      }
      .sync-banner {
        white-space: normal;
      }
      .rates {
        gap: 8px;
      }
      .rate-value {
        min-width: 44px;
      }
      .btn {
        width: 100%;
        justify-content: center;
      }
      .rates-actions {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
      }
      .rates-actions .btn {
        width: auto;
      }
      .nav-logout button {
        padding: 6px 0;
      }
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
