html { font-family: sans-serif; background: #eee; padding: 1rem; }
body { max-width: 960px; margin: 0 auto; background: white; }
h1 { font-family: serif; color: #377ba8; margin: 1rem 0; }
h2 { color: #377ba8; margin: 1.5rem 0 1rem 0; font-size: 1.3em; border-bottom: 2px solid #377ba8; padding-bottom: 0.5rem; }
h3 { color: #333; margin: 0; font-size: 1.1em; }
a { color: #377ba8; }
hr { border: none; border-top: 1px solid lightgray; }
nav { background: lightgray; display: flex; align-items: center; padding: 0 0.5rem; }
nav h1 { flex: auto; margin: 0; }
nav h1 a { text-decoration: none; padding: 0.25rem 0.5rem; }
nav ul  { display: flex; list-style: none; margin: 0; padding: 0; }
nav ul li a, nav ul li span, header .action { display: block; padding: 0.5rem; }
.content { padding: 0 1rem 1rem; }
.content > header { border-bottom: 1px solid lightgray; display: flex; align-items: flex-end; }
.content > header h1 { flex: auto; margin: 1rem 0 0.25rem 0; }
.flash { margin: 1em 0; padding: 1em; background: #cae6f6; border: 1px solid #377ba8; }
.post > header { display: flex; align-items: center; font-size: 0.85em; }
.post > header > div:first-of-type { flex: auto; }
.post > header h1 { font-size: 1.5em; margin-bottom: 0; }
.post .about { color: slategray; font-style: italic; margin-top: 0.25em;}
.post .body { white-space: pre-line; }
.content:last-child { margin-bottom: 0; }
.content form { margin: 0.5em 0; display: flex; flex-direction: row; gap: 1em; min-width: 10em;}
.content label { font-weight: bold; margin-bottom: 0.5em; }
.content input, .content textarea { margin-bottom: 0em; }
.content textarea { min-height: 12em; resize: vertical; }
input.danger { color: #cc2f2e; }
input[type=submit] { align-self: start; max-width: 10em; }
input[type=number] {max-width: 5em;}
input[type=text] {max-width: 5em;}
.ticker {font-weight: bold; color: #377ba8;}
.position_container {margin-top: 1em;}
.holdings_container {margin-top: 1em; padding-bottom: 1em; border-bottom: 1px solid lightgray;}
.open_orders_container {margin-top: 2em; padding-bottom: 2em;}
.holding_info {display: flex; flex-direction: row; gap: 1em; margin-top: 1em;}
.position_info {display: flex; flex-direction: row; gap: 1em; margin-top: 1em;}
.position_info form { margin: 0 0;}
.holding_info form { margin: 0 0;}
.order_info {display: flex; flex-direction: row; gap: 1em; margin-top: 1em;}
.order_info form { margin: 0 0;}
.ticker_order {display: flex; flex-direction: row; gap: 1em; margin-top: 1em; font-weight: bold;}
.ticker_order form { margin: 0 0;}
.position_modifiers { border-bottom: 1px solid lightgray; }
.account_form { flex-direction: column !important; }
.form_item { display: flex; flex-direction: row; justify-content: space-between; max-width: 17em;}
.account_buttons { display: flex; flex-direction: column;}
.account_buttons form { margin: 0 0;}
.summary_container{
display: flex;
flex-direction: row;
gap: 2em;
}
.summary_entry {
display: flex;
gap: 0.75em;
margin-top: 0.25em;
color: slategray;
}

/* Account Summary Styles */
.account_summary_container {
  margin-bottom: 2em;
}

.summary_column {
  flex: 1;
}

.summary_label {
  font-weight: bold;
  color: #555;
}

.summary_value {
  font-weight: bold;
  color: #377ba8;
  font-size: 1.1em;
}

.account_toggle {
  display: flex;
  align-items: center;
  gap: 1em;
}

/* Toggle Switch Styles */
.toggle_switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  margin: 0;
}

.toggle_switch input {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.toggle_slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle_slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle_switch input:checked + .toggle_slider {
  background-color: #4CAF50;
}

.toggle_switch input:checked + .toggle_slider:before {
  transform: translateX(26px);
}

.toggle_status {
  font-weight: bold;
  font-size: 0.9em;
}

.toggle_status.enabled {
  color: #4CAF50;
}

.toggle_status.disabled {
  color: #999;
}

/* Protocols Section */
.protocols_container {
  margin-bottom: 2em;
}

.protocol_card {
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5em;
  margin-bottom: 1.5em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.protocol_header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
  padding-bottom: 1em;
  border-bottom: 1px solid #ddd;
}

.protocol_name {
  margin: 0;
}

.protocol_actions {
  display: flex;
  align-items: center;
  gap: 1em;
}

.protocol_details {
  margin-top: 1em;
}

.protocol_info_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1em;
}

.protocol_info_item {
  display: flex;
  justify-content: space-between;
  padding: 0.5em;
  background: white;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.info_label {
  color: #666;
  font-size: 0.9em;
}

.info_value {
  font-weight: bold;
  color: #333;
}

/* Button Styles */
.btn_sync, .btn_edit, .btn_cancel {
  padding: 0.4em 1em;
  border: 1px solid #377ba8;
  background: white;
  color: #377ba8;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s;
}

.btn_sync:hover, .btn_edit:hover {
  background: #377ba8;
  color: white;
}

.btn_cancel {
  border-color: #cc2f2e;
  color: #cc2f2e;
}

.btn_cancel:hover {
  background: #cc2f2e;
  color: white;
}

/* Inline Form Styles */
.inline_form {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0;
}

.inline_form button {
  margin: 0;
}

.inline_form input {
  margin: 0;
}

/* Open Orders Styles */
.order_item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1em;
  margin-bottom: 0.5em;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.order_details {
  display: flex;
  gap: 1.5em;
  align-items: center;
}

.order_type {
  font-weight: bold;
  color: #4CAF50;
  min-width: 50px;
}

.order_type.sell {
  color: #cc2f2e;
}

.order_quantity {
  font-weight: bold;
}

.order_price {
  color: #666;
}

.order_time {
  color: #999;
  font-size: 0.9em;
  font-family: monospace;
}

/* Settings Form */
.settings_form {
  max-width: 500px;
  margin: 0;
}

.form_row {
  margin-bottom: 1.5em;
  display: flex;
  align-items: center;
  gap: 1em;
}

.form_row > label {
  font-weight: bold;
  min-width: 100px;
  margin: 0;
}

.form_row input[type="number"] {
  padding: 0.5em;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 120px;
  margin: 0;
}

.radio_options {
  display: flex;
  gap: 1.5em;
}

.radio_label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  cursor: pointer;
  margin: 0;
  font-weight: normal;
}

.radio_label input[type="radio"] {
  margin: 0;
  cursor: pointer;
}

.form_row input[type="submit"] {
  background: #377ba8;
  color: white;
  border: none;
  padding: 0.6em 1.5em;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin: 0;
}

.form_row input[type="submit"]:hover {
  background: #2d6290;
}

.btn_secondary {
  padding: 0.6em 1.5em;
  border: 1px solid #999;
  border-radius: 4px;
  color: #666;
  text-decoration: none;
  display: inline-block;
  background: white;
}

.btn_secondary:hover {
  background: #f5f5f5;
  border-color: #666;
}

/* Trade Page Styles */
.protocol_status {
  display: flex;
  align-items: center;
  gap: 1.5em;
}

.position_summary {
  font-weight: bold;
  color: #333;
  font-size: 1.05em;
}

.expiry_info {
  color: #666;
  font-size: 0.95em;
}

.trade_form_horizontal {
  display: flex;
  align-items: center;
  gap: 0.75em;
}

.trade_form_horizontal label {
  font-weight: bold;
  color: #555;
  font-size: 0.95em;
  white-space: nowrap;
  margin: 0;
}

.trade_form_horizontal input[type="number"] {
  padding: 0.6em;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  width: 120px;
  margin: 0;
}

.trade_form_horizontal input[type="number"]:focus {
  outline: none;
  border-color: #377ba8;
}

.checkbox_label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  cursor: pointer;
  font-weight: normal !important;
}

.checkbox_label input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.btn_primary {
  background: #377ba8;
  color: white;
  border: none;
  padding: 0.75em 1.5em;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
  white-space: nowrap;
  margin: 0;
}

.btn_primary:hover {
  background: #2d6290;
}

.btn_rollover_small {
  background: #ff9800;
  color: white;
  border: none;
  padding: 0.5em 1em;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9em;
  transition: background 0.2s;
}

.btn_rollover_small:hover {
  background: #e68900;
}

/* Open Orders Section */
.open_orders_section {
  margin-top: 2em;
  padding-top: 2em;
  border-top: 2px solid #e0e0e0;
}

.section_header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5em;
}

.section_header h2 {
  margin: 0;
  border: none;
  padding: 0;
}

.btn_cancel_all {
  background: #cc2f2e;
  color: white;
  border: none;
  padding: 0.6em 1.2em;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.btn_cancel_all:hover {
  background: #a32524;
}

.orders_grid {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.order_card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25em;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: all 0.2s;
}

.order_card:hover {
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.order_details {
  display: flex;
  gap: 1.5em;
  align-items: center;
  flex: 1;
}

.order_side {
  font-weight: bold;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  min-width: 60px;
  text-align: center;
}

.order_side.buy {
  background: #4CAF50;
  color: white;
}

.order_side.sell {
  background: #cc2f2e;
  color: white;
}

.order_quantity {
  font-weight: bold;
  color: #333;
}

.order_price {
  color: #666;
}

.no_orders {
  text-align: center;
  color: #999;
  padding: 2em;
  font-style: italic;
}