/* URL Shortener tab — styled with the dashboard's own theme variables so it
   matches light and dark automatically. Everything is scoped under .us- / #us-root
   so it can't collide with the rest of the app. */

#us-root { font-family: var(--font-sans); color: var(--foreground); }

.us-loading, .us-empty {
  padding: 40px 20px; text-align: center; color: var(--muted-foreground);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 8px;
}
.us-empty b { color: var(--foreground); }

/* toolbar */
.us-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.us-count { color: var(--muted-foreground); font-size: 14px; font-weight: 600; }
.us-actions { display: flex; gap: 8px; }

/* buttons */
.us-btn {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  padding: 9px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--foreground); transition: filter .12s, background .12s;
}
.us-btn:hover { filter: brightness(0.97); }
.us-btn.primary { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.us-btn.ghost { background: transparent; }
.us-btn.sm { padding: 6px 10px; font-size: 13px; }
.us-btn.danger { color: var(--destructive, #e41e3f); border-color: var(--border); }
.us-btn.danger:hover { background: var(--destructive, #e41e3f); color: #fff; }
.us-btn:disabled { opacity: .6; cursor: default; }

/* link cards */
.us-list { display: flex; flex-direction: column; gap: 12px; }
.us-card {
  display: flex; gap: 16px; align-items: stretch; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); flex-wrap: wrap;
}
.us-card-main { min-width: 0; flex: 1 1 320px; }
.us-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.us-title { font-weight: 700; font-size: 15px; color: var(--foreground); }
.us-shorturl { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; min-width: 0; }
.us-shorturl a { color: var(--primary); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-shorturl a:hover { text-decoration: underline; }
.us-copy { font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--muted); color: var(--foreground); }
.us-dest { color: var(--muted-foreground); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.us-card-side { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.us-clicks { text-align: center; min-width: 56px; }
.us-clicks .n { display: block; font-size: 22px; font-weight: 800; color: var(--foreground); line-height: 1; }
.us-clicks .lbl { font-size: 11px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .04em; }
.us-row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 220px; }

/* pills */
.us-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--muted); color: var(--muted-foreground); }
.us-pill.on { background: rgba(49,162,76,.15); color: #2e9c4a; }
.us-pill.off { background: rgba(228,30,63,.12); color: var(--destructive, #e41e3f); }
.us-pill.rule { background: var(--accent); color: var(--accent-foreground); }
.us-pill.bot { background: rgba(247,185,40,.18); color: #b7860b; }

/* modal */
.us-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; z-index: 4000; padding: 40px 16px; overflow-y: auto; }
.us-modal { background: var(--card); color: var(--foreground); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; }
.us-modal.wide { max-width: 720px; }
.us-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.us-modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.us-x { background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted-foreground); }
.us-modal-body { padding: 20px; }

/* forms */
.us-form { display: flex; flex-direction: column; gap: 14px; }
.us-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--foreground); }
.us-form .req { color: var(--destructive, #e41e3f); }
.us-form .opt { color: var(--muted-foreground); font-weight: 400; }
.us-form input[type="text"], .us-form input[type="url"], .us-form input[type="number"], .us-form input[type="datetime-local"], .us-form select {
  font: inherit; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--input);
  background: var(--background); color: var(--foreground); width: 100%;
}
.us-form input:focus, .us-form select:focus { outline: 2px solid var(--ring); outline-offset: -1px; }
.us-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.us-check input { width: auto; }
.us-adv summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--primary); margin-bottom: 10px; }
.us-adv[open] { display: flex; flex-direction: column; gap: 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.us-form-foot { display: flex; justify-content: flex-end; gap: 10px; align-items: center; margin-top: 4px; }
.us-form-err { color: var(--destructive, #e41e3f); font-size: 13px; font-weight: 600; }
.us-hint { color: var(--muted-foreground); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }

/* analytics */
.us-daytabs { display: flex; gap: 6px; margin-bottom: 16px; }
.us-daytab { font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; padding: 5px 12px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); }
.us-daytab.on { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.us-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.us-tile { background: var(--muted); border-radius: var(--radius); padding: 14px; text-align: center; }
.us-tile .tn { font-size: 26px; font-weight: 800; color: var(--foreground); }
.us-tile .tl { font-size: 12px; color: var(--muted-foreground); }
.us-breaks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.us-break h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .04em; }
.us-bar { display: grid; grid-template-columns: 70px 1fr 34px; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.us-bar .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--foreground); }
.us-bar .bt { background: var(--muted); border-radius: 6px; height: 8px; overflow: hidden; }
.us-bar .bf { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.us-bar .bn { text-align: right; color: var(--muted-foreground); font-weight: 600; }
.us-nobreak { color: var(--muted-foreground); font-size: 13px; padding: 6px 0; }
.us-recent-h { margin: 4px 0 10px; font-size: 14px; }

/* tables */
.us-tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.us-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.us-table th, .us-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.us-table th { background: var(--muted); color: var(--muted-foreground); font-weight: 700; }
.us-table tr:last-child td { border-bottom: none; }

/* rules & blocklist rows */
.us-rules-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.us-rule { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); flex-wrap: wrap; }
.us-rule-r { display: flex; align-items: center; gap: 10px; }
.us-rule-act { font-size: 12px; color: var(--muted-foreground); }
.us-rule-form { border-top: 1px dashed var(--border); padding-top: 14px; }
.us-rule-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.us-rule-grid input, .us-rule-grid select { font: inherit; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--input); background: var(--background); color: var(--foreground); }

/* toast (fallback if the app has no global toast) */
.us-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 5000; padding: 12px 20px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; transition: opacity .25s, transform .25s; color: #fff; }
.us-toast.ok { background: #31a24c; }
.us-toast.err { background: var(--destructive, #e41e3f); }
.us-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .us-tiles, .us-breaks { grid-template-columns: 1fr; }
  .us-rule-grid { grid-template-columns: 1fr; }
  .us-card-side { width: 100%; justify-content: space-between; }
  .us-row-actions { max-width: none; }
}
