* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  background: #f0f2f5;
  color: #1c1e21;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-page > .page {
  flex: 1;
  min-height: 0;
}

.landing-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
}

.landing-brand {
  margin: 0;
  font-size: 34px;
  color: #1877f2;
}

.landing-brand-link {
  margin: 0;
  font-size: 34px;
  color: #1877f2;
  text-decoration: none;
  font-weight: 700;
}

.login-icon-link {
  color: #1877f2;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid #1877f2;
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
}

.portfolio-top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Horizontal padding matches .landing-topbar (18px 24px) so the card aligns with nmillion … Dashboard */
.portfolio-page {
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
  padding: 12px 24px 40px;
  box-sizing: border-box;
}

.portfolio-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  padding: clamp(16px, 3vw, 24px);
  box-sizing: border-box;
  overflow: hidden;
}

.portfolio-header {
  margin: 0 0 4px;
}

.portfolio-header h2 {
  display: block;
  margin: calc(-1 * clamp(16px, 3vw, 24px)) calc(-1 * clamp(16px, 3vw, 24px)) 12px;
  padding: 12px 16px;
  border-radius: 10px 10px 0 0;
  background: #1877f2;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
  text-align: left;
  font-weight: 700;
}

.portfolio-subtitle {
  margin: 0 0 16px;
  color: #4b4f56;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
}

.portfolio-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 12px;
  margin: 0 0 16px;
  width: 100%;
}

.portfolio-toolbar-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.portfolio-btn {
  width: auto;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 700;
  flex: 0 0 auto;
}

.portfolio-hint {
  color: #65676b;
  font-size: 13px;
  margin-left: auto;
  flex: 0 1 auto;
  text-align: right;
  max-width: 100%;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.admin-users-table th,
.admin-users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f2f5;
  text-align: left;
  font-size: 14px;
}

.admin-users-table th {
  background: #f5f8ff;
  color: #31579e;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.landing-page {
  padding: 12px 24px 40px;
}

.landing-grid {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 20px;
}

.landing-market-grid {
  max-width: 980px;
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: 20px;
}

.landing-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.landing-card h2 {
  display: block;
  margin: -24px -24px 14px;
  padding: 12px 16px;
  border-radius: 10px 10px 0 0;
  background: #1877f2;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
}

.landing-card p {
  margin: 0 0 18px;
  color: #4b4f56;
  text-align: left;
}

.landing-action {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  background: #1877f2;
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 700;
}

.rates-box {
  margin-top: 16px;
  background: #f5f8ff;
  border: 1px solid #dce7ff;
  border-radius: 8px;
  padding: 12px;
}

.rates-box h3 {
  margin: 0 0 10px;
  color: #31579e;
  font-size: 15px;
}

.rates-updated {
  margin: 0 0 10px;
  font-size: 12px;
  color: #5a6f9a;
  text-align: left;
}

.rates-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rates-box li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #cfdcff;
  color: #1c1e21;
  font-size: 14px;
}

.rates-box li:last-child {
  border-bottom: 0;
}

.rates-box strong {
  color: #1877f2;
}

.market-disclaimer {
  margin: -8px 0 12px;
  font-size: 12px;
  color: #65676b;
  text-align: left;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.market-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #65676b;
  padding: 6px 4px;
  border-bottom: 1px solid #e4e6eb;
}

.market-table td {
  padding: 8px 4px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: top;
}

.market-table td:first-child {
  min-width: 0;
}

.market-table .sym {
  display: block;
  font-weight: 700;
  color: #1c1e21;
}

.market-table .name {
  display: block;
  font-size: 11px;
  color: #65676b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.market-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}

.market-table .pos {
  color: #0a7d2f;
  font-weight: 600;
}

.market-table .neg {
  color: #c40000;
  font-weight: 600;
}

.calculator-page {
  padding: 12px 24px 40px;
}

.calculator-card {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  padding: 24px;
}

.calculator-card h2 {
  margin: 0 0 8px;
}

.calculator-card p {
  margin: 0 0 16px;
}

.calculator-card .btn-primary {
  background: #1877f2;
}

.calculator-card .btn-primary:hover {
  background: #166fe5;
}

.calc-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.result-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.result-box {
  background: #f5f8ff;
  border: 1px solid #dce7ff;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.result-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #31579e;
}

.result-box p {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1c1e21;
}

.auth-layout {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.auth-layout-single {
  max-width: 420px;
  grid-template-columns: 1fr;
}

.brand h1 {
  font-size: 58px;
  line-height: 1;
  margin: 0 0 16px;
  color: #1877f2;
}

.brand p {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  max-width: 480px;
}

.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
  padding: 18px 16px 24px;
}

.card h2 {
  margin: 4px 0 14px;
  font-size: 22px;
}

.card-brand {
  margin: 0 0 8px;
  text-align: center;
  color: #1877f2;
  font-size: 40px;
  line-height: 1;
}

.field {
  width: 100%;
  border: 1px solid #dddfe2;
  border-radius: 6px;
  font-size: 17px;
  padding: 14px 12px;
  margin-bottom: 12px;
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 12px 10px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: #1877f2;
}

.btn-primary:hover {
  background: #166fe5;
}

.btn-success {
  background: #42b72a;
}

.btn-success:hover {
  background: #36a420;
}

.link {
  display: block;
  text-align: center;
  margin: 14px 0;
  color: #1877f2;
  text-decoration: none;
  font-size: 14px;
}

.divider {
  border: 0;
  border-top: 1px solid #dadde1;
  margin: 20px 0;
}

.center {
  text-align: center;
}

.flash {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}

.flash-error {
  background: #ffe7e7;
  color: #a40000;
}

.flash-success {
  background: #e7f8ec;
  color: #146c2e;
}

.g-recaptcha {
  margin: 6px 0 14px;
}

.dash {
  max-width: 700px;
  margin: 80px auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  padding: 28px;
}

.dash a {
  color: #1877f2;
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .landing-grid {
    grid-template-columns: 1fr;
  }

  .landing-market-grid {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .brand h1 {
    font-size: 48px;
  }

  .brand p {
    font-size: 24px;
  }
}
/* Navbar and dropdown styles for global consistency */
.navbar {
  --navbar-bg: rgba(35, 213, 213, 0.7);
  width: 100%;
  background: var(--navbar-bg);
  color: #004080;
  padding: 1rem 0.5rem 1rem 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.menu {
  display: flex;
  gap: 1rem;
}
.menu a {
  color: #004080;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background: var(--navbar-bg);
  transition: background 0.2s, color 0.2s;
}
.menu a:hover {
  background: #23D5D5;
  color: #004080;
}
.login-link {
  margin-left: auto;
  color: #004080;
  background: var(--navbar-bg);
}
.dropdown {
  position: relative;
  display: inline-block;
}
.dropbtn {
  cursor: pointer;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: rgba(35, 213, 213, 0.95);
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 4px;
  left: 0;
}
.dropdown-content a {
  color: #004080;
  padding: 0.5rem 1rem;
  text-decoration: none;
  display: block;
  border-radius: 4px;
}
.dropdown-content a:hover {
  background-color: #23D5D5;
}
.dropdown:hover .dropdown-content {
  display: block;
}
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f7f6;
}
.form-container, .dash-container {
  width: 100%;
  max-width: 400px;
  margin: 80px auto;
  background: #fff;
  padding: 1.5rem 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  box-sizing: border-box;
}
h2, h1 {
  text-align: center;
  margin-bottom: 1rem;
}
input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}
button, .btn {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  background: #16a085;
  border: none;
  color: white;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
}
button:hover, .btn:hover {
  background: #12876f;
}

.auth-layout-single .btn-primary,
.auth-layout-single .btn-success {
  background: #1877f2;
}

.auth-layout-single .btn-primary:hover,
.auth-layout-single .btn-success:hover {
  background: #166fe5;
}

.auth-layout-single .card h2 {
  color: #1877f2;
}
.error {
  background: #ffefef; color: #c00;
  padding: 0.75rem; border-radius: 4px;
  margin-bottom: 1rem; font-size: .95rem;
  text-align: center;
}
p { text-align: center; margin-top: 1rem; }

/* Portfolio: undo legacy globals (full-width teal buttons) + Tabulator theme aligned with index.php / landing cards */
.portfolio-page .portfolio-toolbar .portfolio-toolbar-buttons .btn,
.portfolio-page .portfolio-toolbar .portfolio-toolbar-buttons button.btn {
  width: auto;
  max-width: none;
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
  background: #1877f2;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 14px;
  cursor: pointer;
}

.portfolio-page .portfolio-toolbar .portfolio-toolbar-buttons .btn:hover,
.portfolio-page .portfolio-toolbar .portfolio-toolbar-buttons button.btn:hover {
  background: #166fe5;
}

.portfolio-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px;
  box-sizing: border-box;
}

.portfolio-table-scroll .tabulator {
  font-size: 13px;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
  background: #fff;
  min-width: 100%;
}

.portfolio-table-scroll .tabulator .tabulator-header {
  background: #f5f8ff;
  color: #31579e;
  border-bottom: 1px solid #dce7ff;
  font-weight: 600;
}

.portfolio-table-scroll .tabulator .tabulator-header .tabulator-col {
  background: #f5f8ff;
}

.portfolio-table-scroll .tabulator .tabulator-row.tabulator-row-even {
  background-color: #fafbfc;
}

.portfolio-table-scroll .tabulator .tabulator-row.tabulator-selected,
.portfolio-table-scroll .tabulator .tabulator-row.tabulator-row-even.tabulator-selected {
  background-color: #e7f3ff;
}

.portfolio-table-scroll .tabulator .tabulator-cell {
  border-right: 1px solid #f0f2f5;
}

.portfolio-table-scroll .tabulator .tabulator-header .tabulator-col {
  border-right: 1px solid #e4e6eb;
}

@media (max-width: 640px) {
  .portfolio-toolbar .portfolio-hint {
    flex: 1 1 100%;
    margin-left: 0;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .portfolio-page .portfolio-toolbar .portfolio-toolbar-buttons {
    gap: 6px;
  }

  .portfolio-page .portfolio-toolbar .portfolio-toolbar-buttons .btn,
  .portfolio-page .portfolio-toolbar .portfolio-toolbar-buttons button.btn {
    font-size: 13px;
    padding: 8px 10px;
  }
}

/* Portfolio # column: drag handle + row menu (⋮) */
.portfolio-table-scroll .portfolio-row-gutter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.portfolio-table-scroll .portfolio-row-num {
  min-width: 1.25em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.portfolio-table-scroll .portfolio-row-drag {
  flex: 0 0 14px;
  width: 14px;
  height: 22px;
  cursor: grab;
  border-radius: 3px;
  align-self: center;
  background: repeating-linear-gradient(
    #bec3c9 0 2px,
    transparent 2px 4px
  );
  background-size: 3px 100%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.65;
}

.portfolio-table-scroll .portfolio-row-drag:active {
  cursor: grabbing;
}

.portfolio-table-scroll .portfolio-row-drag:hover {
  opacity: 1;
  background-color: rgba(24, 119, 242, 0.12);
}

.portfolio-table-scroll .portfolio-row-menu-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: #65676b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  vertical-align: middle;
}

.portfolio-table-scroll .portfolio-row-menu-btn:hover {
  background: #e4e6eb;
  color: #1877f2;
}

.portfolio-row-menu-dropdown {
  background: #fff;
  border: 1px solid #e4e6eb;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
  padding: 6px 0;
}

.portfolio-row-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  color: #1c1e21;
}

.portfolio-row-menu-item:hover {
  background: #f0f2f5;
}

.portfolio-row-menu-item-danger {
  color: #c40000;
}

.portfolio-row-menu-item-danger:hover {
  background: #ffe7e7;
}

.portfolio-table-scroll .tabulator-row.portfolio-row-draft {
  background-color: #f0f7ff !important;
}