* {
  box-sizing: border-box;
  color: #ffffff;
}

body {
  font: 14px/1.5 Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #313338;
}

header {
  background: #1e1f22;
}
header .logo {
  padding: 1em;
  text-align: center;
}
header .logo img {
  max-height: 40px;
  width: auto;
}

main {
  padding: 20px;
}

a {
  text-decoration: none;
  color: inherit;
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: normal;
  margin: 0 0 0.7em 0;
}

h2 {
  margin: 0.7em 0 1.3em 0;
}

.items {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1em;
}
.items.chat {
  grid-template-columns: 1fr 1fr;
}
.items .item {
  position: relative;
  padding: 0.7em;
  border-radius: 7px;
  background-color: #3f4147;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.15);
}
.items .item.item-clickable {
  cursor: pointer;
  transition: background-color 0.2s;
}
.items .item.item-clickable:hover {
  background-color: #2b2d31;
}
.items .item .cadenceWidthPrice {
  margin-bottom: 0.7em;
  display: flex;
  gap: 0.7em;
}
.items .item .subscription-actions {
  display: flex;
  justify-content: flex-end;
}
.items .item p {
  margin: 0;
  color: #9b9b9b;
}
.items .item .price-badge,
.items .item .cadence-badge {
  font-size: 12px;
  display: flex;
  line-height: 1;
  border-radius: 3px;
  color: yellow;
  border: 1px solid yellow;
  padding: 0.2em 0.7em 0.1em 0.7em;
}

.tab-menu {
  display: flex;
  border-bottom: 2px solid t(border);
}
.tab-menu .tab-button {
  background: none;
  border: 0;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0.3em 0.7em;
  font-size: 12px;
}
.tab-menu .tab-button.active, .tab-menu .tab-button:hover {
  border-bottom: 2px solid #fffb00;
}

.tab-content:not(.active) {
  display: none;
}

.tab-content form,
.tab-content {
  display: flex;
  gap: 1.7em;
  flex-direction: column;
}

button {
  line-height: 1;
  background: #a00;
  border: none;
  padding: 0.7em 1.3em;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}
button:hover {
  opacity: 0.8;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-subscribe {
  background: #a00;
}

.btn-cancel {
  background: #a00;
}

.btn-enable {
  background: #a00;
}

.set-default-form {
  display: inline;
}

.btn-set-default {
  background: #a00;
}

.btn-add-item,
.btn-create {
  background: #a00;
  color: #ffffff;
}

.btn-sync {
  background: #0066cc;
  color: #ffffff;
  font-size: 13px;
  padding: 0.5em 1em;
}
.btn-sync:hover {
  background: #0052a3;
}

.app-link {
  display: inline-block;
  padding: 0.9em 1.5em;
  background: #2b2d31;
  border: 1px solid #515253;
  border-radius: 4px;
  transition: border-color 0.2s;
}
.app-link:hover {
  border-color: #fffb00;
}

.form-group label {
  display: block;
  margin-bottom: 0.5em;
  font-size: 13px;
  color: #9ca3af;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.8em;
  border: 1px solid #3f4147;
  border-radius: 4px;
  background: #1e1f22;
  color: #ffffff;
  font-size: 14px;
  transition: border-color 0.2s;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
}
input::placeholder,
select::placeholder,
textarea::placeholder {
  color: #515253;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

.card-item {
  background: #2b2d31;
  padding: 1em;
  border-radius: 4px;
  border: 1px solid #3f4147;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
}
.card-item.is-default {
  border-color: #fffb00;
  background: rgba(255, 251, 0, 0.05);
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  font-size: 14px;
  color: #d1d5db;
  flex: 1;
}
.card-info .card-details {
  display: block;
}

.set-default-form {
  flex-shrink: 0;
}

.status-badge {
  position: absolute;
  top: -1em;
  right: -1em;
  width: 47px;
  height: 47px;
  line-height: 1.3;
  display: inline-flex;
  border-radius: 50px;
  font-size: 10px;
  color: #17181a;
  padding: 0.3em 0.8em;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5em;
}
.status-badge.active {
  background: #fffb00;
}
.status-badge.inactive {
  background: #263c5f;
  color: #9ca3af;
}
.status-badge.completed {
  background: #fffb00;
}
.status-badge.pending {
  background: #f59e0b;
  color: #17181a;
}
.status-badge.canceled {
  background: #263c5f;
  color: #9ca3af;
}
.status-badge.failed {
  background: #ef4444;
  color: #fff;
}
.status-badge.expired {
  background: #666;
  color: #ccc;
}

.message {
  padding: 0.9em;
  border-radius: 4px;
  margin-bottom: 1.3em;
  border-left: 3px solid;
}
.message.success {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
}
.message.error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.no-data {
  border: 1px solid #3f4147;
  border-radius: 7px;
  text-align: center;
  padding: 2.5em 1em;
  color: #6b7280;
}
.no-data p {
  margin: 0.5em 0;
}

section {
  margin-bottom: 1.7em;
}

.sync-header {
  margin-bottom: 1.7em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sync-header h2 {
  margin: 0;
}
.sync-header small {
  color: #999;
}
.sync-header form {
  display: inline;
}

.close {
  background: none;
  border: 0;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.close:hover {
  color: #ffffff;
}

.hidden {
  display: none;
}

.text-center {
  text-align: center;
}

.sandbox-indicator {
  position: fixed;
  bottom: 0;
  right: 0;
  background: #f59e0b;
  color: white;
  padding: 0.4em 1em;
  font-size: 12px;
  z-index: 1000;
  border-bottom-left-radius: 4px;
}

.debug-section {
  background: #1e1f22;
  border: 1px solid #3f4147;
  border-radius: 4px;
  padding: 1em;
  font-size: 12px;
  margin-top: 1.5em;
}
.debug-section button {
  font-size: 12px;
  padding: 0.5em 1em;
}

.footer-nav {
  margin-top: 2.5em;
  padding-top: 1.5em;
  border-top: 1px solid #3f4147;
}
.footer-nav h2 {
  text-align: center;
  margin-bottom: 1.3em;
}
.footer-nav .nav-links {
  display: flex;
  justify-content: center;
  gap: 0.8em;
  flex-wrap: wrap;
}

.user-info-card {
  background: #2b2d31;
  border: 1px solid #3f4147;
  border-radius: 4px;
  padding: 1.3em;
  margin-bottom: 1.3em;
}
.user-info-card h3 {
  margin-bottom: 0.8em;
}
.user-info-card p {
  margin: 0.6em 0;
  color: #d1d5db;
}
.user-info-card p strong {
  color: #9ca3af;
  font-size: 12px;
}

.friend-add-section {
  background: #2b2d31;
  border: 1px solid #3f4147;
  border-radius: 4px;
  padding: 1.3em;
  text-align: center;
}
.friend-add-section h4 {
  margin-bottom: 1em;
}

.friend-add-btn {
  display: inline-block;
  padding: 0.9em 1.5em;
  background: #06c755;
  color: white;
  border-radius: 4px;
  transition: opacity 0.2s;
}
.friend-add-btn:hover {
  opacity: 0.8;
}

.notice-card {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid #f59e0b;
  border-radius: 4px;
  padding: 1em;
}
.notice-card h4 {
  color: #fbbf24;
  margin-bottom: 0.5em;
}
.notice-card p {
  color: #fcd34d;
  margin: 0.3em 0;
}

.note {
  margin-top: 0.5em;
  font-size: 12px;
  color: #6b7280;
}

.add-item-section {
  margin-top: 1.3em;
  text-align: center;
}

.purchase-history-container {
  min-height: 200px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
}

.history-item {
  background: #2b2d31;
  padding: 1em;
  border-radius: 4px;
  border: 1px solid #3f4147;
}
.history-item h4 {
  margin-bottom: 0.5em;
}
.history-item p {
  margin: 0.3em 0;
  color: #d1d5db;
  font-size: 14px;
}
.history-item small {
  color: #9ca3af;
  font-size: 12px;
}

.btn-image {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 0.3em 0.5em;
  margin-right: 0.3em;
  transition: transform 0.2s;
}
.btn-image:hover {
  transform: scale(1.1);
}
.btn-image:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-image {
  width: 100%;
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
  display: block;
  margin: 0.3em 0;
  transition: transform 0.2s;
}
#image-modal {
  background: rgba(0, 0, 0, 0.95);
}

.image-modal-content {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  padding: 0;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-modal-content .close {
  display: none;
}
.image-modal-content img {
  width: 100%;
  max-height: 100vh;
  object-fit: contain;
  display: block;
  margin: 0;
  border-radius: 0;
  cursor: default;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-content {
  background: #fff;
  padding: 2em 3em;
  border-radius: 8px;
  text-align: center;
}
.loading-content img {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 1em;
}
.loading-content p {
  margin: 0;
  color: #333;
  font-size: 14px;
  font-weight: bold;
}
