body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
}
header {
    background: #ffffff;
    color: #004085;
    padding: 10px 0 10px;
    box-shadow: 0 4px 10px rgba(0, 64, 133, 0.35);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-inner {
    width: 80%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 12px;
}
.header-content {
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 16px;
}
.header-links a {
    color: #004085;
    text-decoration: none;
    margin-right: 12px;
}
.header-links {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1;
}
.header-tagline {
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 40px;
    font-weight: 600;
    color: #193560;
    letter-spacing: 0.2px;
    line-height: 1;
}
.header-logo {
    height: 132px;
    width: auto;
    display: block;
}
.top-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding-bottom: 0;
    align-self: flex-end;
}
.account-link {
    justify-self: end;
    align-self: flex-start;
    margin-right: 24px;
}

.account-menu {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 8px 0;
    display: none;
    z-index: 2100;
}

.menu-dropdown a {
    display: block;
    padding: 10px 14px;
    text-decoration: none;
    color: #193560;
    font-weight: 600;
    font-size: 14px;
}

.menu-dropdown a:hover {
    background: rgba(0, 64, 133, 0.08);
}

.menu-dropdown.is-open {
    display: block;
}
.top-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: #004085;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(0,64,133,0.2);
    background: rgba(0,64,133,0.06);
    transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}
.top-nav-link:hover {
    background: rgba(0,64,133,0.12);
    border-color: rgba(0,64,133,0.35);
    transform: translateY(-1px);
}
.top-nav-link.active {
    background: #004085;
    color: #ffffff;
    border-color: #004085;
}
.container {
    max-width: 1100px;
    width: 80%;
    margin: 16px auto;
    padding: 0 12px 40px 12px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.feed {
    flex: 1 1 auto;
    width: 100%;
    margin: 0 auto;
    
}
.sidebar {
    flex: 1;
    position: sticky;
    top: 16px;
}
/* Hide sidebar entirely when it has no content so the feed centers */
.sidebar:empty {
    display: none;
}
.panel {
    background: white;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-size: 12px;
}
.panel h3 {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: #004085;
}
.reset-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #c00;
    background: #fff;
    color: #c00;
    cursor: pointer;
}
.reset-btn:hover {
    background: #c00;
    color: #fff;
}
.brain-list {
    list-style: none;
    padding-left: 0;
    margin: 4px 0;
}
.brain-list li {
    margin-bottom: 2px;
}
.explain-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.explain-table th,
.explain-table td {
    border-bottom: 1px solid #eee;
    padding: 2px 3px;
    vertical-align: top;
}
.explain-table th {
    text-align: left;
    font-weight: 600;
    color: #444;
}
.card {
    background: white;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: box-shadow 120ms ease;
    overflow: hidden;
}

/* System cards (non-article cards) */
.card.system-card {
    background: #e9f2ff; /* light blue background */
    border: 1px solid rgba(0, 64, 133, 0.15);
}

.card.system-card .card-title {
    color: #004085;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.card.system-card .summary-preview {
    color: #2b3f66;
}
/* Show full auth card text without clamping */
.system-auth .summary-preview {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}
.system-auth .summary-preview.clamp-3 {
    min-height: 0;
}

/* Auth system card specific actions */
.system-auth .notice-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.system-auth .btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}

.system-auth .btn-primary {
    background: #004085;
    color: white;
    border: 1px solid #004085;
}

.system-auth .btn-primary:hover {
    background: #003060;
}

.system-auth .btn-secondary {
    background: white;
    color: #004085;
    border: 1px solid rgba(0, 64, 133, 0.4);
}

.system-auth .btn-secondary:hover {
    background: #f0f6ff;
}

/* Hover lift for non-active cards */
.card:not(.active):hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Active (opened) card: blue ring + stronger shadow all around */
.card.active {
    box-shadow:
        0 0 0 2px rgba(0, 64, 133, 0.35),
        0 4px 12px rgba(0, 64, 133, 0.16),
        0 1px 3px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

/* Keep the blue ring even while hovering the active card */
.card.active:hover {
    box-shadow:
        0 0 0 2px rgba(0, 64, 133, 0.35),
        0 4px 12px rgba(0, 64, 133, 0.16),
        0 1px 3px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.source {
    font-size: 11px;
    color: #777;
    text-transform: uppercase;
}
.title {
    font-size: 20px;
    margin: 4px 0 6px 0;
    cursor: pointer;
    color: #0f172a;
    font-weight: 600;
}
.meta {
    margin-top: 4px;
    font-size: 14px;
    color: #64748b;
}
.summary-preview,
.details-body,
.details-text {
    font-size: 17px;
    line-height: 1.45;
    color: #334155;
    font-family: inherit;
    font-weight: 400;
}
.details-text {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.summary-preview {
    margin-top: 6px;
}

/* Collapsed preview: clamp to 3 lines */
.clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* Keep collapsed cards visually consistent: reserve space for 3 lines even if shorter */
.card .summary-preview.clamp-3 {
    min-height: calc(1.45em * 2);
}

/* Expanded text should never be clamped */
.full-text {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.details-body,
.details-text {
    margin-bottom: 12px;
}

.details {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}
.source-link a {
    font-size: 13px;
    color: #004085;
}

/* Responsive layout */
@media (max-width: 1024px) {
    .header-inner,
    .container {
        width: 90%;
    }
    .header-tagline {
        font-size: 32px;
    }
    .header-logo {
        height: 110px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 8px 0 8px;
    }
    .header-inner,
    .container {
        width: 95%;
    }
    .header-content {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand account"
            "nav nav";
        gap: 8px 12px;
    }
    .header-links {
        grid-area: brand;
        justify-content: flex-start;
        flex-direction: row;
        align-items: center;
        text-align: left;
    }
    .header-tagline {
        font-size: 26px;
    }
    .header-logo {
        height: 90px;
    }
    .top-nav {
        grid-area: nav;
        justify-content: center;
        width: 100%;
    }
    .account-link {
        grid-area: account;
        justify-self: end;
        align-self: center;
        margin-right: 0;
    }
    .container {
        flex-direction: column;
        gap: 0;
    }
    .feed {
        width: 100%;
    }
    .title {
        font-size: 19px;
    }
    .summary-preview,
    .details-body,
    .details-text {
        font-size: 15px;
    }
    .meta {
        font-size: 12px;
    }
    .sidebar {
        position: static;
        width: 100%;
        margin-top: 12px;
    }
}

@media (max-width: 480px) {
    .header-tagline {
        font-size: 22px;
    }
    .header-logo {
        height: 72px;
    }
    .top-nav-link {
        padding: 8px 14px;
        font-size: 13px;
    }
    .title {
        font-size: 18px;
    }
    .summary-preview,
    .details-body,
    .details-text {
        font-size: 14px;
    }
    .meta {
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    .modal-card {
        width: min(460px, 94vw);
        padding: 18px 18px 16px;
    }
    .modal-card h2 {
        font-size: 24px;
    }
    .modal-subtitle {
        font-size: 15px;
    }
.modal-label {
    font-size: 15px;
}
.modal-remember {
    font-size: 15px;
}
    .modal-input {
        font-size: 16px;
        padding: 10px 12px;
    }
    .modal-primary,
    .modal-secondary {
        font-size: 16px;
        padding: 10px 12px;
    }
    .modal-error {
        font-size: 13px;
    }
    .modal-close {
        font-size: 22px;
    }
}

/* Auth modal */
.auth-btn {
  background: #ffffff;
  color: #004085;
  border: 1px solid #cfd8e3;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-card {
  position: relative;
  width: min(420px, 92vw);
  background: #ffffff;
  border-radius: 10px;
  padding: 18px 20px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  border: 1px solid #e6e6e6;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  right: 12px;
  top: 10px;
  border: none;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
  color: #999;
}

.modal-card h2 {
  margin: 0 0 4px 0;
  color: #004085;
  font-size: 26px;
}

.modal-subtitle {
  margin: 0 0 14px 0;
  color: #666;
  font-size: 16px;
}

.modal-label {
  display: block;
  font-size: 16px;
  margin: 8px 0 4px;
  color: #444;
}

.modal-remember {
  margin: 10px 0 4px;
  font-size: 15px;
  color: #444;
}

.modal-remember input {
  margin-right: 6px;
}

.modal-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d7d7d7;
  border-radius: 6px;
  font-size: 17px;
  outline: none;
}

.modal-input:focus {
  border-color: #004085;
  box-shadow: 0 0 0 2px rgba(0, 64, 133, 0.15);
}

.modal-primary {
  width: 100%;
  margin-top: 12px;
  background: #004085;
  color: white;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 17px;
  cursor: pointer;
}

.modal-secondary {
  width: 100%;
  margin-top: 8px;
  background: #ffffff;
  color: #004085;
  border: 1px solid #cfd8e3;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 17px;
  cursor: pointer;
}
.modal-error {
  margin-top: 8px;
  min-height: 16px;
  font-size: 14px;
  color: #b00020;
}
.is-hidden {
  display: none;
}
