* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: #f3f5f8; color: #1f2933; }
body.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
h1 { margin: 0; font-size: 1.4rem; }
.muted { color: #6b7785; font-size: .9rem; }
.card { background: #fff; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.06); padding: 1.5rem; }

.login { width: 100%; max-width: 360px; display: flex; flex-direction: column; }
.login h1 { margin-bottom: .25rem; }
.login label { margin-top: 1rem; font-size: .85rem; font-weight: 600; }
.login input { margin-top: .35rem; padding: .65rem .75rem; border: 1px solid #cfd6de; border-radius: 6px; font-size: 1rem; }
.login input:focus { outline: 2px solid #2563eb33; border-color: #2563eb; }
.login button { margin-top: 1.5rem; }

button, .btn { background: #2563eb; color: #fff; border: 0; border-radius: 6px; padding: .65rem 1rem; font-size: .95rem; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: #1d4ed8; }
.btn { padding: .35rem .75rem; font-size: .85rem; }
button.link { background: none; color: #2563eb; padding: 0; font-size: inherit; }
button.link:hover { text-decoration: underline; background: none; }

.alert { margin-top: 1rem; padding: .6rem .8rem; border-radius: 6px; background: #eef4ff; color: #1e3a8a; font-size: .9rem; }
.alert.error { background: #fdecec; color: #9b1c1c; }

header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; background: #fff; border-bottom: 1px solid #e3e8ee; }
header .user { display: flex; gap: .75rem; align-items: center; font-size: .9rem; }
header form { margin: 0; }
main { max-width: 1000px; margin: 2rem auto; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.toolbar input { padding: .5rem .75rem; border: 1px solid #cfd6de; border-radius: 6px; width: 260px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .5rem; border-bottom: 1px solid #eef1f4; text-align: left; font-size: .92rem; }
th a { color: #1f2933; text-decoration: none; }
tbody tr:hover { background: #f8fafc; }
.r { text-align: right; }
.ext { display: inline-block; min-width: 42px; text-align: center; font-size: .7rem; text-transform: uppercase; background: #eef1f4; color: #52606d; border-radius: 4px; padding: .15rem .3rem; margin-right: .4rem; }
.empty { text-align: center; padding: 2rem 0; }

main > .card { margin-bottom: 1.25rem; }
main > .alert { margin: 0 0 1rem; }
.alert.success { background: #e8f7ee; color: #146c3a; }
button:disabled { background: #9db6ec; cursor: not-allowed; }

.upload form { display: flex; gap: 1rem; align-items: stretch; }
#dropzone { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  padding: 1.25rem; border: 2px dashed #cfd6de; border-radius: 8px; cursor: pointer; text-align: center; font-size: .95rem;
  transition: border-color .15s, background .15s; }
#dropzone:hover, #dropzone.over { border-color: #2563eb; background: #f3f7ff; }
#dropzone.bad { border-color: #d64545; background: #fdf3f3; }
#dropzone strong { color: #2563eb; }
#file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload button { min-width: 120px; }
.actions { white-space: nowrap; }
.actions form { display: inline; margin: 0 0 0 .35rem; }
.btn.danger { background: #fff; color: #c53030; border: 1px solid #f1c4c4; }
.btn.danger:hover { background: #c53030; color: #fff; border-color: #c53030; }
/* Header breadcrumb */
.brand { display: flex; align-items: center; gap: .6rem; }
.home-link { color: #2563eb; text-decoration: none; font-size: .95rem; }
.home-link:hover { text-decoration: underline; }
.crumb-sep { color: #b0b9c3; }

/* Landing page */
.welcome { margin: 0 0 1.25rem; }
.sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
.section { display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: inherit;
  border: 1px solid transparent; transition: transform .15s, box-shadow .15s, border-color .15s; }
a.section:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); border-color: #2563eb; }
.section h2 { margin: 0; font-size: 1.15rem; }
.section p { margin: 0; flex: 1; }
.section-icon { font-size: 1.8rem; }
.section-cta { margin-top: .75rem; font-size: .9rem; font-weight: 600; color: #2563eb; }
.section.disabled { opacity: .6; cursor: default; }
.section.disabled .section-cta { color: #6b7785; font-weight: 500; }

/* Threat links page */
.add-link summary { cursor: pointer; font-weight: 600; color: #2563eb; list-style: none; }
.add-link summary::-webkit-details-marker { display: none; }
.link-form { display: flex; flex-direction: column; margin-top: .5rem; }
.link-form label { margin-top: 1rem; font-size: .85rem; font-weight: 600; }
.link-form input, .link-form textarea { margin-top: .35rem; padding: .6rem .75rem; border: 1px solid #cfd6de;
  border-radius: 6px; font: inherit; font-size: .95rem; }
.link-form input:focus, .link-form textarea:focus { outline: 2px solid #2563eb33; border-color: #2563eb; }
.link-form textarea { resize: vertical; }
.link-form button { margin-top: 1.25rem; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  padding: 1rem .25rem; border-bottom: 1px solid #eef1f4; }
.link-list li:last-child { border-bottom: 0; }
.link-body { min-width: 0; }
.link-title { font-weight: 600; font-size: 1.02rem; color: #1d4ed8; text-decoration: none; }
.link-title:hover { text-decoration: underline; }
.link-url { font-size: .8rem; margin-top: .15rem; word-break: break-all; }
.link-summary { margin: .5rem 0 0; font-size: .92rem; line-height: 1.45; }
.link-meta { font-size: .78rem; margin-top: .5rem; }

/* User Inputs page */
.card-title { margin: 0; font-size: 1.05rem; }
.post-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.post-actions button { margin-top: 0; }
.small { font-size: .8rem; margin: .5rem 0 0; }
.post-content { white-space: normal; overflow-wrap: anywhere; line-height: 1.55; font-size: .95rem;
  background: #f8fafc; border: 1px solid #eef1f4; border-radius: 8px; padding: 1rem; max-height: 70vh; overflow-y: auto; }

main { padding: 0 1rem; }
header { gap: 1rem; }
header .user { white-space: nowrap; }
@media (max-width: 700px) {
  header { padding: .85rem 1rem; flex-wrap: wrap; }
  header h1 { font-size: 1.15rem; }
  main { margin-top: 1.25rem; }
}
@media (max-width: 600px) { .upload form { flex-direction: column; } }
